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
Chemistry,
23 days ago
Computer Science,
1 month ago
Physics,
8 months ago
Math,
8 months ago
English,
8 months ago