C Online Compiler
Example: Fixed Multiplication Table in C
C
C++
C#
Java
Python
PHP
main.c
STDIN
Run
// Fixed Multiplication Table #include <stdio.h> int main() { // Step 1: Declare variables int number = 7; // The number for which we want the multiplication table int i = 1; // Loop counter, starting from 1 printf("Multiplication Table of %d:\n", number); // Step 2: Use a while loop to iterate from 1 to 10 while (i <= 10) { // Step 3: Calculate and print each line of the table printf("%d x %d = %d\n", number, i, (number * i)); // Step 4: Increment the counter i++; } return 0; }
Output
Clear
ADVERTISEMENTS