C Programming.


C tutorials program for Printing Tables
C Program to enter a number and print Table for it |
|
|
// Program name : test076.c// WAP to enter a number and print Table for it#include <stdio.h>#include <conio.h>void main(){int n, no;clrscr();printf("Enter an integer for Table : ");scanf("%d",&no);printf("Table of %d \n",no);for(n = 1; n<= 10; n++)printf("%d x %d = %d \n ",no,n,no*n);getch();} |
Output |
Enter an integer for Table : 5Table of 55 x 1 = 55 x 2 = 105 x 3 = 155 x 4 = 205 x 5 = 255 x 6 = 305 x 7 = 355 x 8 = 405 x 9 = 455 x 10 = 50 |
C Program to enter a number and print Table from 1 upto that no |
|
|
// Program name : test077.c// WAP to enter a number and print Table from 1 upto that no#include <stdio.h>#include <conio.h>void main(){int n, no;clrscr();printf("Enter an integer to print table from 1 upto that no : ");scanf("%d",&no);for(int x=1; x<=no;x++){printf("Table of %d \n",no);for(n = 1; n <= 10; n++)printf("%d x %d = %d \n ",x,n,x*n);printf("\n \n");}} |
Output |
Enter an integer to print table from 1 upto that no : 3Table of 11 x 1 = 11 x 2 = 21 x 3 = 31 x 4 = 41 x 5 = 51 x 6 = 61 x 7 = 71 x 8 = 81 x 9 = 91 x 10 = 10Table of 22 x 1 = 22 x 2 = 42 x 3 = 62 x 4 = 82 x 5 = 102 x 6 = 122 x 7 = 142 x 8 = 162 x 9 = 182 x 10 = 20Table of 33 x 1 = 33 x 2 = 63 x 3 = 93 x 4 = 123 x 5 = 153 x 6 = 183 x 7 = 213 x 8 = 243 x 9 = 273 x 10 = 30 |