Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

sum of first 100 natural numbers

#include<iostream>
using namespace std;
int main(){
int i = 0;
int sum = 0;
int n = 100;
while(i<=n){
    sum = sum + i;
    i++;
}
cout << sum;
return 0;
}
 
PREVIOUS NEXT
Tagged: #sum #natural #numbers
ADD COMMENT
Topic
Name
2+7 =