A for loop can be nested inside another for loop to display the multiplication tables of multiple numbers. In this program, the outer for loop controls the table number from 5 to 10, while the inner for loop multiplies each number by the values 1 to 10. The result is displayed in a tabular format.
How It Works?
k and m.for loop to generate table numbers from 5 to 10.for loop to multiply the current table number by values from 1 to 10.printf() function.#include <stdio.h> #include <conio.h> main() { int k, m; clrscr(); printf("Table Of 5 to 10"); printf("\n\n"); for(k = 5; k <= 10; k++) { for(m = 1; m <= 10; m++) { printf("%d\t", k * m); } printf("\n"); } getch(); }
5 10 15 20 25 30 35 40 45 50 6 12 18 24 30 36 42 48 54 60 7 14 21 28 35 42 49 56 63 70 8 16 24 32 40 48 56 64 72 80 9 18 27 36 45 54 63 72 81 90 10 20 30 40 50 60 70 80 90 100
nested for loops to display the multiplication tables from 2 to 6. Each table should contain the multiplication results from 1 to 10.for loops to generate multiple multiplication tables using rows and columns.for loop to control the table number from 2 to 6. Use the inner for loop to multiply each table number by values from 1 to 10.#include <stdio.h> #include <conio.h> main() { int k, m; clrscr(); printf("Table Of 2 to 6"); printf("\n\n"); for(k = 2; k <= 6; k++) { for(m = 1; m <= 10; m++) { printf("%d\t", k * m); } printf("\n"); } getch(); }
Table Of 2 to 6 2 4 6 8 10 12 14 16 18 20 3 6 9 12 15 18 21 24 27 30 4 8 12 16 20 24 28 32 36 40 5 10 15 20 25 30 35 40 45 50 6 12 18 24 30 36 42 48 54 60
for loops. The outer loop generates the table numbers from 2 to 6, while the inner loop multiplies each table number by the numbers from 1 to 10. After completing one table, the program moves to the next line and prints the next multiplication table.