Here is the program which generates a table of a given input number.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include "conio.h" #include "stdio.h" void main() { int num,result,i=1; printf("\nEnter a number to generate the table : "); scanf("%d",&num); printf("\nThe table of %d is given below",num); while(i<=10) { result=num*i; printf("\n\t %d * %d = %d",num,i,result); i++; } getch(); } |
Output
Enter a number to generate the table : 3 The table of 3 is given below 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 |