Tuesday, May 24, 2016

NIELIT M3-R4: Q.No. 5(c) July 2014

M3-R4: July 2014 (O-Level)

Q. 5(c):
Write a function to display the multiplication table of the number.

Ans:
Function to display the multiplication table of a number passed as an argument:

void multiTable(int num){
    int i;
    printf("\nMultiplication Table of %d:\n", num);
    for(i=1; i<=10; i++){
        printf("\n%d x %d = %d", num, i, num*i);
    }
    printf("\n");
    getch();
}

The above function can be called from main() as:

multiTable(12);

No comments:

Post a Comment