VALUES

Multiplication Table using C program

C program to print Multiplication Table



                    Hello, In this blog we see the c program code to print multiplication table. In this program user give the input and depends on that integer number the multiplication table will displayed.

Code:

#include
#include
void main()
{
 int s,i,a;
 clrscr();
    printf(“Enter the number to print the multiplication table: “);
    scanf(“%d”,&s);
    printf(“\n”);
 for(i=1; i <= 10; i++)
 {
     printf(“%d”,s);
     printf(” * “);
     printf(“%d”,i);
     a=s*i;
     printf(“=%d”,a);
     printf(“\n”);
 }
getch();
}

         In the above code we use variable ‘s’ to store the input value. And by using for loop the actual multiplication table is displayed.

Output:

Enter the number to print the multiplication table:7
7 * 1 = 7
7 * 2 = 14
7 * 3 = 21
7 * 4 = 28
7 * 5 = 35
7 * 6 = 42
7 * 7 = 49
7 * 8 = 56
7 * 9 = 63
7 * 10 = 70

Related Articles

Back to top button