Wednesday, 11 March 2015

Printing addition table of the given number Using C


# include <stdio.h>
# include <conio.h>

void main()
{
int i, t, n ;
clrscr() ;
printf("Enter the table : ") ;
scanf("%d", &t) ;
printf("\nEnter the limit : ") ;
scanf("%d", &n) ;
printf("\nThe table is :\n\n") ;
for(i = 1 ; i <= n ; i++)
printf("%4d + %4d = %4d\n", i, t, i + t) ;
getch() ;
}

RUN 1 :
~~~~~~~
Enter the table : 5
Enter the limit : 15
The table is :
1 + 5 = 6
2 + 5 = 7
3 + 5 = 8
4 + 5 = 9
5 + 5 = 10
6 + 5 = 11
7 + 5 = 12
8 + 5 = 13
9 + 5 = 14
10 + 5 = 15
11 + 5 = 16
12 + 5 = 17
13 + 5 = 18
14 + 5 = 19
15 + 5 = 20

No comments:

Post a Comment