#include<iostream.h>
#include<conio.h>
void main()
{
int n, m, a=0, b=0;
cout<<"Enter the starting number :";
cin>>n;
cout<<"Enter the last number :";
cin>>m;
a=n;
int i=0;
do
{
a=n+i;
b=b+a;
i++;
}while(i<=m-n);
cout<<"Sum of the range ="<<b;
getch();
}
.................................................................
OUTPUT: (click to enlarge the image)
No comments:
Post a Comment