C++ Calculate the sum from 1 to 100
###### Posted by Samath
Last Updated: January 05, 2017

This program calculate the sum from 1 to 100 using do-while loop.

```#include <iostream>
using namespace std;

int main()
{
int i, sum;
sum = 0;
i = 1;

do
{
sum = sum + i;
i = i + 1;
} while (i <= 100);
cout << "Result: " << sum;
cin.get();
return 0;
}```

###### Sum of two values in C
Samath | Nov 09, 2014
###### C Program to find sum of two numbers
Samath | Jan 02, 2017
###### Write a C++ program that find the sum of all even numbers between 1 and 30 excluding 6, 8, 24 and 28
Samath | Nov 02, 2014
###### Sum of the first 30 squares in C
Samath | Dec 21, 2014
###### Java program that uses a loop to compute the sum of all odd digits of an input. (For example, if the input is 32677, the sum would be 3 + 7 + 7 = 17.)
Samath | Apr 03, 2022
###### Recursive function that find the sum of digits in a integer using C++
Samath | Dec 24, 2014
###### C Program to calculate sum of 5 subjects, calculate percentage and grade
Samath | Jan 02, 2017
###### C program to find sum of elements of the array
Samath | Jan 02, 2017
###### Java program that prints the sum of the first ten positive integers
Samath | Jan 08, 2021
###### Java program that uses a loop to compute the sum of all even numbers between 2 and 100 (inclusive)
Samath | Apr 03, 2022
###### C program that prompts the user for a positive integer and then computes the sum of all the digits of the number
Samath | May 04, 2016
###### C Program to Compute sum of the array elements using pointers
Samath | Jan 02, 2017
###### Java program that uses a loop to compute the sum of all squares between 1 and 100 (inclusive)
Samath | Apr 03, 2022
###### Java program that uses a loop to compute the sum of all even numbers between a and b (inclusive), where a and b are inputs
Samath | Apr 03, 2022