Home  >  Article  >  Backend Development  >  Print the multiplication table of a given number in C

Print the multiplication table of a given number in C

王林
王林forward
2023-09-06 11:53:051350browse

Program Description

Print the multiplication table for a given number

Algorithm

Accepts any number provided by the user that needs to be formed into a multiplication

Starting from the value of I, multiply the given number (=1)

Increment the given number and the value of I until the value of I is less than or equal to 12.

Example

/* Program to print the multiplication table of a given number */
#include <stdio.h>
int main() {
   int number, i;
   clrscr();
   printf("Please enter any number to find multiplication table:");
   scanf("%d", &number);
   printf("Multiplication table for the given number %d: ", number);
   printf("</p><p>");
   for(i=1;i<=12;i++){
      printf("%d x %d = %d", number, i, number * i);
      printf("</p><p>");
   }
   getch();
   return 0;
}

Output

Print the multiplication table of a given number in C

The above is the detailed content of Print the multiplication table of a given number in C. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete