Math, asked by arvindec38151, 2 months ago

Write a program to print the sum of first n natural number

Answers

Answered by bhumikapatel9321
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