Ticker

6/recent/ticker-posts

C program for Maths table for a given number

MATHS TABLE FOR GIVEN A NUMBER




EXAMPLE - I
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,n;
printf("Enter any number:");
scanf("%d",&n);

for(i=1; i<=10; i++)
{
printf("\n%d",n*i);
}
getch();
}
}

----------------------------
         OUTPUT 
----------------------------
Enter any number: 2
2
4
6
8
10
12
14
16
18
20


EXAMPLE - II
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,n,r;
printf("Enter any number:");
scanf("%d",&n);

printf("'Enter the range:");
scanf("%d",&r);

for(i=1; i<=r; i++)
{
printf("\n%d x %d = %d",n, i, n*i);
}
getch();
}
}

----------------------------
         OUTPUT 
----------------------------
Enter any number: 5
Enter the range: 10
5 x 1 = 5
5 x 2 = 5
5 x 3 = 5
5 x 4 = 5
5 x 5 = 5
5 x 6 = 5
5 x 7 = 5
5 x 8 = 5
5 x 9 = 5
5 x 10 = 5
5 x 11 = 5
5 x 12 = 5
5 x 13 = 5
5 x 14 = 5
5 x 15 = 5

















HOME

Post a Comment

0 Comments