C++ program that display the series of odd Number from I to F i.e (from initial value to final value) define by a user - 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 odd Number from I to F i.e (from initial value to final value) define by a user

C++ program that display the series of odd Number from I to  F i.e (from initial value to final value) define by a user


#include <iostream>

using namespace std;

int main()
{
   int  f,i,sum=0;
   cout<< "Enter the intial value : ";
   cin>>i;
   cout<< "Enter the final value : ";
   cin>>f;
   for(int n=1;n<=f;n+=2){

   cout<<n<<endl;
    sum+=n;

   }
  cout<< "the sum of number from "<<i<<" to "<<f<<" = "<<sum<<endl;
    return 0;
}


No comments:

Post a Comment

ads1

Post Top Ad