Using while or do while loop: wap to read any integer number and print its multiplication table
#include <stdio.h> int main() { int num; /*to store number*/ int i; /*loop counter*/ /*Reading the number*/ printf("Enter an integer number: "); scanf("%d",&num); /*Initialising loop counter*/ i=1; /*loop from 1 to 10*/ while(i<=10){ printf("%d\n",(num*i)); i++; /*Increase loop counter*/ } return 0; }
Output
Enter an integer number: 12 12 24 36 48 60 72 84 96 108 120
/*Initialising loop counter*/ i=1; /*loop from 1 to 10*/ do{ printf("%d\n",(num*i)); i++; /*Increase loop counter*/ }while(i<=10);
for(i=1;i<=10;i++){ printf("%d\n",(num*i)); }
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Complete program using while loop
Output
Code using do while loop
Code using for loop
need an explanation for this answer? contact us directly to get an explanation for this answer