Repitition Statements
Repitition Statements
Write a program in C++ to find the sum of the first 10 natural numbers.
Write a program in C++ to display n terms of natural numbers and their sum.
Sample Output:
Input a number of terms: 7
The natural numbers upto 7th terms are:
1234567
The sum of the natural numbers is: 28
Write a program in C++ to find the Greatest Common Divisor (GCD) of two
numbers.
Sample Output:
Input the first number: 25
Input the second number: 15
The Greatest Common Divisor is: 5
Write a program in C++ to calculate the sum of the series (1*1) + (2*2) + (3*3) +
(4*4) + (5*5) + ... + (n*n).
Sample Output:
Input the value for nth term: 5
1*1 = 1
2*2 = 4
3*3 = 9
4*4 = 16
5*5 = 25
Write a program in C++ to calculate the series (1) + (1+2) + (1+2+3) + (1+2+3+4)
+ ... + (1+2+3+4+...+n).
Sample Output:
Input the value for nth term: 5
1=1
1+2 = 3
1+2+3 = 6
1+2+3+4 = 10
1+2+3+4+5 = 15
The sum of the above series is: 35
Write a C++ program to print all numbers between a and b (a and b inclusive) using
for loops
Nested Loops