Learn about C Program for Multiplication table in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.
Contents
C Program for Multiplication table
We will utilize two variables in this program: num
and i
. The variable num
stores the input integer number, and the variable i
iterates the loop. num*i
represents the number’s product.
Source code:
#include<stdio.h>
int main()
{
int num, i;
printf("Enter a number: ");
scanf("%d",&num);
for(i=1;i<=10;i++)
{
printf(" %d * %d = %d\n", num, i, num*i);
}
return 0;
}
Output:
Enter a number: 3 3 * 1 = 3 3 * 2 = 6 3 * 3 = 9 3 * 4 = 12 3 * 5 = 15 3 * 6 = 18 3 * 7 = 21 3 * 8 = 24 3 * 9 = 27 3 * 10 = 30
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Codes :
C Program to Find Factors of a Number using recursion
C Program to Find Factors of a Number using a function