C Online Compiler
Example: Multiplication Tables for a Range in C
C
C++
C#
Java
Python
PHP
main.c
STDIN
Run
// Multiplication Tables for a Range #include <stdio.h> int main() { // Step 1: Define the range for which tables are to be generated. // Outer loop will iterate from start_num to end_num (inclusive). int start_num = 1; int end_num = 10; // Step 2: Outer loop to iterate through each number in the range. for (int current_num = start_num; current_num <= end_num; current_num++) { printf("\n--- Multiplication Table for %d ---\n", current_num); // Step 3: Inner loop to generate the multiplication table for current_num. for (int i = 1; i <= 10; i++) { // Step 4: Calculate the product. int product = current_num * i; // Step 5: Print the result. printf("%d x %d = %d\n", current_num, i, product); } } return 0; }
Output
Clear
ADVERTISEMENTS