Lecture 87
// Loop While
#include <iostream>
#include <conio.h>
using namespace std;
main ()
{
int i,sum=0;
i=1;
while(i<=20)
{
sum+=i;
i++;
}
cout<<"1 to 20 number of Sum:
"<<sum;
getch();
return 0;
}
Code view in dev compiler:
Compile the program Ctrl+F9
Run program Ctrl+F10