Print mathematical table of the given number
The user will give an input of which table he want, based on the input given the output should be displayed.This can be explained with an example:
For example if the given table is 5 then the output should be 5 table
INPUT: 5
OUTPUT:
5 * 1 = 5
5 * 2 = 10
5 * 3 = 15
5 * 4 = 20
5 * 5 = 25
5 * 6 = 30
5 * 7 = 35
5 * 8 = 40
5 * 9 = 45
5 * 10 = 50
Program:
/*C program to write table of given number*/
| # include<stdio.h> } |
Output:
Enter the table you want: 2 2 * 1 = 2 2 * 2 = 4 2 * 3 = 6 2 * 4 = 8 2 * 5 = 10 2 * 6 = 12 2 * 7 = 14 2 * 8 = 16 2 * 9 = 18 2 * 10 = 20 |
Initially we declare header files required for the program.The program begins from main() , two variables 'i' and 'table' are declared as int type. The printf() is used to display the given text on the screen and scanf() will take the input from the user, then the logic to print the required table is executed; and the table is printed as the output.
No comments:
Post a Comment