- This program generates a multiplication table for a number provided by the user.
- We’ll use a
for loop
to multiply the number by values from 1 to 10 and print each result.
#include <stdio.h>
int main() {
int num;
// Asking user for a number
printf("Enter a number for the multiplication table: ");
scanf("%d", &num);
// Generating the multiplication table
for (int i = 1; i <= 10; i++) {
printf("%d x %d = %d\n", num, i, num * i);
}
return 0;
}
Thank you for providing me with these article examples. May I ask you a question?
Yes Sure, if it is under our boundary we will surely reply it.
Thanks for your help and for writing this post. It’s been great.
Thank you for providing me with these article examples. May I ask you a question?