WSQ07

here is my code!

<iostream>

using namespace std;

 

int main (){

  //this program will sum the range of the values you enter.

  long f;

  long l;

  long sum;

 

 

   cout <<“enter the lower value “;

   cin >> f;

   cout << “enter the last value “;

   cin >> l;

 

   if (f < l)

    {

     int Temp;

 

     Temp  = f;

     f = l;

     f  = Temp;

 

     }

 

 

       for( int Counter = f; Counter <= l; Counter++ )

       sum += Counter ;

 

       cout << “nSum of numbers from ” << f << ” to ” << l

         << ” = ” << sum << endl;

 

     return 0;

}

 

CC BY 4.0 WSQ07 by carlos green is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.