Computer Science, asked by chhavigarg845, 5 months ago

create a program that accept a number and then prints a table for that number​

Answers

Answered by SabrinaHaque
1

I'm a C programmer, that's why I've answered it with C.

#include <stdio.h>

int main() {

int n, i, range;

printf("Enter an integer: ");

scanf("%d", &n);

// prompt user for positive range

do {

printf("Enter the range (positive integer): ");

scanf("%d", &range);

} while (range <= 0);

for (i = 1; i <= range; ++i) {

printf("%d * %d = %d \n", n, i, n * i);

}

return 0;

}

Similar questions