Monday, June 18, 2012

To print the table of a given number


/* To print the table of given number */
#include<stdio.h>
#include<conio.h>
void main()
{
  int i,num,mul;
  clrscr();
  printf("Enter the number: ");
  scanf("%d",&num);
  printf("\n\nTable of %d\n",num);
  for(i=1;i<=10;i++)
  {
     mul=num*i;
     printf("\n%d * %d = %d",num,i,mul);
  }
  getch();
}
 
OUTPUT
Enter the number: 9
 
 
Table of 9
 
9 * 1 = 9
9 * 2 = 18
9 * 3 = 27
9 * 4 = 36
9 * 5 = 45
9 * 6 = 54
9 * 7 = 63
9 * 8 = 72
9 * 9 = 81
9 * 10 = 90

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.