Printing addition table of the given number
Program:
#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();
}
Output:
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
-
UpdatedDec 30, 2019
-
Views9,773
You May Like
Program to maintain employee details using structures
Program to maintain student details using structures
Check whether the person is eligible to vote or not
Print the numbers that are divisible by a given no.
Program to generate magic square
To sort the given numbers in ascending & descending order