
Monday 21 May 2012
c program to display the multiplication table of a given num
From w3schools.in
Program: Multiplication table of a given number
#include <stdio.h>
int main() {
int num, i = 1;
printf("\n Enter any Number:");
scanf("%d", &num);
printf("Multiplication table of %d: \n", num);
while (i <= 10) {
printf("\n %d x %d = %d", num, i, num * i);
i++;
}
return 0;
}
Output:
Enter any Number:5
5 x 1 = 5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50
Explanation:
We need to multiply the given number (i.e. the number for which we want
the multiplication table)
with value of 'i' which increments from 1 to 10.
|
This page was last modified on 15 Dec 2011 at 19:51:19. |
Gautam Kumar EDP Manager |
Related Posts
» C program to display the multiplication table of a given num» C program to generate the Fibonacci series
» C program to print a semicolon without using a semicolon
» C program to compare two strings without using strcmp
» C program to concatenate two strings without using strcat
» C program to delete a specified line from a text file
» C program to replace a specified line in a text file
» C program to find the number of lines in a text file
» C program which asks the user for a number between 1 to 9
» C program to check whether the given string is a palindrome
» C program to check whether the given number is a palindromic
» C program to find factorial of the given number
» C program to check whether the given number is even or odd
» C program to swap two numbers using a temporary variable
» C program to swap two numbers using bitwise operators
» C program to find the greatest of three numbers
» C program to find the greatest among ten numbers
» C program to check whether the given number is a prime
» How to create pyramid in c
» Fun with C language.
