Your program will do the following: You are to produce a Multiplication Table in
ID: 670237 • Letter: Y
Question
Your program will do the following:
You are to produce a Multiplication Table in your console window. Your program should prompt the user to input a number (integer type) as the size of that table.
Sample Output: With a size of 5 the Multiplication Table will look like this:
1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
4 8 12 16 20
5 10 15 20 25
Explanation / Answer
#include <stdio.h>
int main()
{
int n, i,j;
printf("Input a number: ");
scanf("%d",&n);
int temp=1;
for(i=1;i<=n;++i)
{
for(j=1;j<=n;j++)
{
printf("%d", temp*j);
printf(" ");
}
temp++;
printf(" ");
}
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.