Sunday, June 8, 2014

C++ Beginners Tutorial 11 - Do While Loops



#include <iostream>
using namespace std;
int main()
{
    int x=1;
    int number=0;
    int sum=0;

    do
    {
        cout<<"input any value"<<endl;
        cin>>number;
        sum=sum+number;

        x++;
    }while(x<1);

    cout<<"The sum is="<<sum<<endl;
    return 0;
}





No comments:

Post a Comment