Write a c program that prints a multiplication table for a given number and the number of rows in the table.

 

#include <stdio.h>


int main() {

    int num, rows, i;


    // Taking input

    printf("Enter the number: ");

    scanf("%d", &num);


    printf("Enter the number of rows: ");

    scanf("%d", &rows);


    // Printing multiplication table

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

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

    }


    return 0;

}





Comments