C Programming Tutorial

Advertisements

Write program to display table of given a number in c



       #include<stdio.h>
       #include<conio.h>
       void main()
       {
              int a,num; 
              clrscr();

              printf("\nEnter any number : "); 
              scanf("%d",&num); 
              
              for(a=1;a<=10;a++)
                 printf("\n%d X %2d = %d",num,a,num*a);

              getch();
       }

   Output : 

              Enter any number : 5
              5 X  1 = 5
              5 X  2 = 10
              5 X  3 = 15
              5 X  4 = 20              
              5 X  5 = 25
              5 X  6 = 30
              5 X  7 = 35
              5 X  8 = 40
              5 X  9 = 45
              5 X 10 = 50




Advertisement