LOOP: (TURBOc++)
Prg15: Write a program that displays a multiplication table for a given number.
Sample output: Enter a number: 3
Multiplication table for 3:
3 x 0 = 0
3 x 1 = 3
3 x 9 =27
PLEASE USE:
#include<stdio.h>
#include<conio.h>
scanf
printf
example:
#include<stdio.h>
#include<conio.h>
main()
{
int n=1, x=20;
clrscr();
printf("While Loop Example");
while (n<=5)
{
gotoxy(x, 3);printf(" %d", n);
n++;x=x+5;
}
getch();
}
#include<stdio.h>
#include<conio.h>
main()
{
int n;
printf("Enter a number\n");
scanf("%d", &n);
int i = 0;
while (i<=12)
{
printf("%d * %d = %d\n", n, i, (n*i));
i++;
}
}
Comments
Leave a comment