Search
 
SCRIPT & CODE EXAMPLE
 

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;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: pointers and arrays in c++ 
Cpp :: one dimensiol array to two dimen c++ 
Cpp :: c++ sizeof 
Cpp :: glm has no member value_ptr 
Cpp :: resharper fold if statement 
Cpp :: Initialize Vector Iterator 
Cpp :: c++ count vector elements 
Cpp :: matrix c++ 
Cpp :: c++ polymorphism 
Cpp :: put function in cpp 
Cpp :: c++ formatting 
Cpp :: how to pass an array by reference in c++ 
Cpp :: ascii allowed in c++ 
Cpp :: closing a ifstream file c++ 
Cpp :: assignment operator with pointers c++ 
Cpp :: STD::ERASE FUNCTION IN C++ 
Cpp :: c++ map 
Cpp :: first and last digit of a number in c++ 
Cpp :: count c++ 
Cpp :: Program to find GCD or HCF of two numbers c++ 
Cpp :: know what the input data is whether integer or not 
Cpp :: min heap 
Cpp :: data type c++ 
Cpp :: ue4 endoverlap c++ 
Cpp :: largest subarray with zero sum 
Cpp :: why the << operator is friend 
Cpp :: convert hex to decimal arduino 
Cpp :: Mirror Inverse Program in c++ 
Cpp :: how to signify esc key in cpp 
Cpp :: coin change top-down 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =