q uestion Four Write a program that asks the user to enter a number between 1 an
ID: 3822381 • Letter: Q
Question
question Four
Write a program that asks the user to enter a number between 1 and 10 then prints the related multiplication table. The program must ask the user if he wants to continue by choosing another number or quit.
NB: you have to run your program then join a screenshot of the execution to your answer file
Typical run of the program:
Give your proposed number between 1 and 10: 4
The Multiplication Table of 4 is
1 * 4 = 4
2 * 4 = 8
3 * 4 = 12
4 * 4 = 16
5 * 4 = 20
6 * 4 = 24
7 * 4 = 28
8 * 4 = 32
9 * 4 = 36
10 * 4 = 40
Do you want to continue Y/N? Y
Give your proposed number between 1 and 10: 7
The Multiplication Table of 7 is
1 * 7 = 7
2 * 7 = 14
…
Explanation / Answer
#include <stdio.h>
#include<conio.h>
void main()
{
void table(int);
int n, i,y,k=1;
printf("Enter an integer: ");
scanf("%d",&n);
table(n);
while(k!=10)
{
printf("Do you want to continue??");
scanf("%d",&y);
if(y){
printf("Enter an integer: ");
scanf("%d",&n);
table(n);
}
else{
break;
}
}
k++;
getch();
}
table(int n){
for(i=1; i<=10; ++i)
{
printf("%d * %d = %d ", n, i, n*i);
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.