Computer Science, asked by anjiladhital211, 4 months ago

WAP to display the sum of numbers 1 to 100​

Answers

Answered by Premsaha99
0

Explanation:

#include <iostream>

#include <cstdlib>

#include <fstream>

#include <cmath>

using namespace std;

int summation(int x){

int summation = (x*(x+1))/2;

return summation;

}

int main()

{

std::cout<<"Summation of 1 to 100: "<<summation(100)<<std::endl;

return 0;

}

Similar questions