Write a program to generate multiplication table

// Write a program to generate multiplication table
// Eg: 2-> multiplication table of 2
#include
int main(){
    int n,i;
    printf("Enter a number:"); // input from user
    scanf("%d",&n);
    while(n<0){
         printf("Please enter positive integer only:");
         scanf("%d",&n);      
    }
    for(i=1;i<=20;i++){
         printf("%d X %d = %d\n",n,i,n*i); // printing multiplicaton table
    }
    getch();
}

No comments:

Post a Comment