This program is used to print the maths number tables.this program works on while loop and for loop also.this will print like following of 1 is entered in it:
1*1=1
1*2=2
1*3=3
1*4=4
1*5=5
1*6=6
1*7=7
1*8=8
1*9=9
1*10=10
Program:
#include<stdio.h>
#include<conio.h>
main()
{
float n,m=1,ans;
clrscr();
printf("Enter Number to view table: ");
scanf("%f",&n);
while(n!=0)
{
for(m=1;m<=10;m++)
{
ans=n*m;
printf("\n%.2f * %.2f = %.2f",n,m,ans);
}
printf("\nPress any key............");
getch();
clrscr();
printf("Enter Number to view table: ");
scanf("%f",&n);
}
return 0;
}
1*1=1
1*2=2
1*3=3
1*4=4
1*5=5
1*6=6
1*7=7
1*8=8
1*9=9
1*10=10
Program:
#include<stdio.h>
#include<conio.h>
main()
{
float n,m=1,ans;
clrscr();
printf("Enter Number to view table: ");
scanf("%f",&n);
while(n!=0)
{
for(m=1;m<=10;m++)
{
ans=n*m;
printf("\n%.2f * %.2f = %.2f",n,m,ans);
}
printf("\nPress any key............");
getch();
clrscr();
printf("Enter Number to view table: ");
scanf("%f",&n);
}
return 0;
}