Write a program to print the sum of first n natural number
Answers
Answered by
1
Answer:
#include<iostream>
using namespace std;
int main()
{
int sum , N;
cout << “Enter the limit";
cin >> N;
//calculating
sum sum= N*(N+1)/2;
cout<<“The Sum of first “<< N <<” Natural Numbers is “<< sum;
return 0;
}
Similar questions