Question
Print Table of 5 using for loop in C Language.
Solution
β Verified
This C program prints the multiplication table of 5 using a for loop. The for loop is used to iterate from 1 to 10, and in each iteration, the loop variable is multiplied by 5 to generate the corresponding multiple.
This simple logic helps in understanding how loops work and how arithmetic operations can be combined with control structures in C. The program is a useful example for beginners learning how to generate tables and apply loops effectively in basic programming tasks.
#include <stdio.h>
int main() {
for (int i = 1; i <= 10; i++) {
printf("5 x %d = %d\n", i, 5 * i);
}
return 0;
}Output:--
5 x 1 = 5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50Β
Click here to download practice questions on
For Loop In C