Home > Backend Development > C++ > body text

Print the multiplication table of a given number in C

王林
Release: 2023-09-06 11:53:05
forward
1352 people have browsed it

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;
}
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template