write a c++ program to find sum for first n whole numbers
Answers
Answered by
1
#include <stdio. h>
#include<conio. h>
class sum
{
int n,b=0,i;
cout <<"enter no:";
cin>>n;
for (i=0; i <n; i++)
{
b=b+i;
}
cout <<"sum of first "<<n <<" no ="<<b;
}
#include<conio. h>
class sum
{
int n,b=0,i;
cout <<"enter no:";
cin>>n;
for (i=0; i <n; i++)
{
b=b+i;
}
cout <<"sum of first "<<n <<" no ="<<b;
}
suyog2:
its my pleasure
Similar questions