Generating a multiplication table isn’t complex. What will take your mind is printing in the given format. Hence, not wasting time let us get on to the logic of this program.
- Input a number from a user whose multiplication table is to be generated. Store it in some variable say num.
- Run a loop from, incrementing
1
on each repetition. The loop structure should look like this for(i=1; i<=10; i++).
- Inside the loop generate a multiplication table using num * I and print in the given format. The sequence of printing multiplication table is n * i = (n * i)
The table in c language
If you want to see it on the compiler then plz click here for a table in c
you can see this program in detail
In this we use for loop for printing table in c language
example is given below
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
long n,i,ans=1;
printf(“Enter no for table”);
scanf(“%ld”,&n);
for(i=1;i<=10;i++)
{
ans=n*i;
printf(“%ld*%ld=%ld\n”,n,i,ans);
}
getch();
}
Advertisements