08 February 2022

Table Of Numers Using Array

 QUESTION:

Print Number Table By Taking User Input.

#include<stdio.h>
 
int main()
{
    int n;
    printf("Enter a Number");
    scanf("%d", &n);

    int mult[10];
    for(int i=0; i<10; i++){
        mult[i] = n * (i+1);  
    }
   
    printf("The table of the number that you have entered is :\n");

    for(int i=0; i<10; i++){
        printf("%d x %d = %d\n", n, (i+1), mult[i]);  
    }
 
return 0;
}

OUTPUT-->

Enter a Number: 11 The table of the number that you have entered is : 11 x 1 = 11 11 x 2 = 22 11 x 3 = 33 11 x 4 = 44 11 x 5 = 55 11 x 6 = 66 11 x 7 = 77 11 x 8 = 88 11 x 9 = 99 11 x 10 = 110

No comments:

Post a Comment