c++ Program that display the series of number from 0 to N in reverse order (the program allow a user to enter the limit of Number)and give the sum of a numbers - 6 Players blogs for technology

give us your feedback

People Online

Breaking

ads

Post Top Ad

Monday, October 14, 2019

c++ Program that display the series of number from 0 to N in reverse order (the program allow a user to enter the limit of Number)and give the sum of a numbers

#include <iostream>

using namespace std;

int main()
{
   int a, number ,sum=0;
   cout<<"Enter the limit of a Number : ";
   cin>>number;

   for(a=number;a>=0;a--){
    cout<<a<<endl;
    sum+=a;

   }
    cout<< "the sum of number from 0 to "<<number<<"in reverse = "<<sum<<endl;
    return 0;
}

No comments:

Post a Comment

ads1

Post Top Ad