Tuesday, September 2, 2014

Program that prints multiplication table of a number (multiplicand and multiplier input by the user)


Problem

Create a program that prints the multiplication table of a number entered by the user (user enter x and y and your program will print the table of x upto y). The table should get displayed in the following form.
2* 1 = 2
2* 2 = 4

Solution - Code

#include<stdio.h>
int main()
{
 int x,y,i;
 printf("Enter x and y: ");
 scanf("%d%d",&x,&y);
 i=1;
 while(i<=y)
 {
  printf("%d*%d=%d\n",x,i,x*i);
  i = i + 1;
 }
 system("pause");
 return 0;
}

Sample Output


1 comment :

  1. Write a C program to Print table of entered number by user through keyboard using for loop.

    Code of given problem:

    int main()

    {
    int i=0,num;
    printf("Enter the number to find its table:\t");
    scanf("%d", &num);
    for(i=1;i<=10;i++)
    {
    printf("%d\n",num*i);
    }
    return 0;
    }

    Very informative blog!

    Please take some time to visit my blog @
    for loop program examples

    Thanks!

    ReplyDelete

Note: Only a member of this blog may post a comment.

Copyright 2017. All Rights Reserved. Privacy Policy / Terms And Conditions / Sitemap / Contact