Control Statements Loops
70 programs in this topic — each includes source code, sample output and explanation.
-
Print Numbers 1 to 10
This program prints numbers from 1 to 10 using a for loop.
-
Print Numbers 1 to 5
This program prints numbers from 1 to 5 using a while loop.
-
Print Numbers 1 to 3
This program prints numbers from 1 to 3 using a do-while loop.
-
Factorial of a Number
This program calculates factorial of a number using for loop.
-
Fibonacci Series
This program prints Fibonacci series using while loop.
-
Sum of Digits
This program calculates the sum of digits of a number using while loop.
-
Reverse a Number
This program reverses a number using while loop.
-
Check Prime Number
This program checks if a number is prime using for loop.
-
Multiplication Table
This program prints multiplication table of 5 using for loop.
-
Multiplication Tables 1 to 3
This program prints multiplication tables from 1 to 3 using nested for loop.
-
Check Armstrong Number
This program checks if a number is Armstrong using while loop.
-
Sum of First N Natural Numbers
This program calculates sum of first N natural numbers using for loop.
-
Factorial Using For Loop
This program calculates factorial of a number using for loop.
-
Check Palindrome Number
This program checks if a number is palindrome using while loop.
-
Prime Numbers in Range
This program prints prime numbers between 1 and 20 using nested for loop.
-
Sum of Even Numbers
This program calculates the sum of even numbers from 1 to 20 using for loop.
-
Sum of Odd Numbers
This program calculates the sum of odd numbers from 1 to 19 using for loop.
-
Factorial Using While Loop
This program calculates factorial of a number using while loop.
-
Prime Series up to N
This program prints prime numbers up to 50 using for loop.
-
Number Grid
This program prints a 3x3 number grid using nested for loop.
-
Sum of Squares
This program calculates sum of squares of first 5 natural numbers.
-
Sum of Cubes
This program calculates sum of cubes of first 4 natural numbers.
-
Count Digits in a Number
This program counts the number of digits in a number using while loop.
-
Sum of Even and Odd Numbers
This program calculates sum of even and odd numbers separately using for loop.
-
Sequential Number Triangle
This program prints a triangle of sequential numbers using nested for loop.
-
Sum of Factorial Series
This program calculates the sum of factorials of first 5 numbers.
-
Prime Factors of a Number
This program prints prime factors of a number using while loop.
-
Arithmetic Progression Series
This program prints arithmetic progression series using for loop.
-
Geometric Progression Series
This program prints geometric progression series using for loop.
-
Multiplication Table Grid
This program prints multiplication tables from 1 to 3 in grid form.
-
Sum of Arithmetic Progression
This program calculates sum of arithmetic progression series.
-
Sum of Geometric Progression
This program calculates sum of geometric progression series.
-
Pascal's Triangle (First 5 Rows)
This program prints Pascal's Triangle using nested for loop.
-
Sum of Prime Numbers
This program calculates the sum of prime numbers up to 20 using for loop.
-
Floyd's Triangle
This program prints Floyd's Triangle using nested for loop.
-
Sum of Prime Numbers up to N
This program calculates the sum of prime numbers up to 30.
-
Sum of Factorial Series
This program calculates sum of factorials from 1! to 6!.
-
Arithmetic Progression Sum
This program calculates sum of arithmetic progression series.
-
Geometric Progression Sum
This program calculates sum of geometric progression series.
-
Prime Number Triangle
This program prints prime numbers in triangular form.
-
Sum of Factorial Digits
This program calculates sum of factorials of digits of a number.
-
Arithmetic Progression Series with While Loop
This program prints arithmetic progression series using while loop.
-
Geometric Progression Series with While Loop
This program prints geometric progression series using while loop.
-
Arithmetic Progression Matrix
This program prints a matrix of arithmetic progression values using nested for loop.
-
Geometric Progression Pyramid
This program prints a pyramid of geometric progression values using nested for loop.
-
Prime Factorization Series
This program prints prime factorization of a number using while loop.
-
Factorial Summation Series
This program calculates sum of factorials from 1! to 7!.
-
Harmonic Series
This program prints harmonic series up to 1/5.
-
Multiplication Grid 1-5
This program prints multiplication grid from 1 to 5 using nested for loop.
-
Sum of Harmonic Series
This program calculates sum of harmonic series up to 1/7.
-
Number Pyramid
This program prints a pyramid of numbers using nested for loop.
-
Sum of Prime Factors
This program calculates sum of prime factors of a number.
-
Magic Square Pattern (3x3)
This program prints a simple 3x3 magic square using nested for loop.
-
Harmonic Series Sum with Precision
This program calculates harmonic series sum with precision up to 1/10.
-
Numeric Checkerboard Grid
This program prints a numeric checkerboard grid using nested for loop.
-
Factorial Sum of Series
This program calculates sum of factorials from 1! to 8!.
-
Prime Number Grid
This program prints prime numbers in a 3x3 grid.
-
Harmonic Progression Series
This program prints harmonic progression series.
-
Sum of Harmonic Progression
This program calculates sum of harmonic progression series.
-
Numeric Pyramid Pattern
This program prints a pyramid of numbers using nested for loop.
-
Factorial Sum with While Loop
This program calculates sum of factorials from 1! to 5! using while loop.
-
Prime Number Pyramid
This program prints prime numbers in pyramid form.
-
Harmonic Progression Sum with While Loop
This program calculates sum of harmonic progression using while loop.
-
Numeric Pyramid with Squares
This program prints a pyramid of squares using nested for loop.
-
Geometric Progression Pyramid with Powers of 3
This program prints a pyramid of powers of 3 using nested for loop.
-
Factorial Summation Grid
This program prints a 3x3 grid of factorial values using nested for loop.
-
Prime Checkerboard Grid
This program prints a checkerboard of prime and non-prime indicators.
-
Harmonic Progression Pyramid
This program prints harmonic progression values in pyramid form.
-
Sequential Number Diamond
This program prints a diamond of sequential numbers using nested for loop.
-
Advanced Numeric Sequence Grid
This program prints a 4x4 grid of alternating squares and cubes.