Earn without any Investment!

Saturday, November 13, 2010

Sum of two numbers using increment operator

#include<iostream.h>
#include<conio.h>
void main()
{
 int a,b,i=1;
 clrscr();
 cout<<"Enter a:";
 cin>>a;
 cout<<"Enter b:";
 cin>>b;
 while(i<=b)
 {
  a=a++;
  i++;
 }
 cout<<"The sum is:";
 cout<<a;
 getch();
}

No comments:

Post a Comment