Skip to main content

C Program to Generate Multiplication Table according to User Choice.

 C Program to Generate Multiplication Table according to User Choice.

    In this program, we will learn how to print a multiplication table according to any positive number entered by the user. This program uses for loop to solve this problem. 


C PROGRAM TO GENERATE MULTIPLICATION TABLE:


#include<stdio.h>
#include<conio.h>
int main()
{
    int i,num,res=0;
    printf("\nEnter the multplication table you want : ");
    scanf("%d",&num);
    printf("\n\n\n\tMULTIPLICATION TABLE OF %d\t",num);
    printf("\n--------------------------------------------------\n");
    for(i=1;i<=10;i++)
    {
        res=num*i;
        printf("\t%d  x %d = %d\n",num,i,res);
    }
    printf("\n\n");
    return 0;
}


OUTPUT:



NOTE: You Can Comment Your Code if you have solved differently and we will pin it in the comment section.  Let's Learn together. 


MOTTO: 

You Learn, I Learn together We Learn.



Comments

Popular posts from this blog

C Program to Print first N Even Natural Number/in Reverse Order

  C Program to Print first N Even Natural Number.     In this example, we will find and print the first N even natural. Here we have used for loop to solve this program.      What are Natural Numbers? Natural Numbers are all positive numbers starting from 1 to infinity.      For Example:  1,2,3,4,5,6,.............................,n are all natural numbers. What are Even Numbers? Even numbers are those numbers whose remainder is 0 when divided by 2.     For Example: 2,4,6,8,10,.....,n are all even numbers.   PROGRAM: #include <stdio.h> #include <conio.h> void   main () {      int   i , x ;      printf ( "Enter the value of N : " );      scanf ( " %d " ,& x );      for ( i = 1 ; i <= x ; i ++)     {          printf ( " %d " , 2 * i );     }      getch (); } OUTPUT: C Program to Print First N Even Natural Number in Reverse Order. PROGRAM 123 #include <conio.h> #include <stdio.h> int   main () {      int   i , x ;      printf

C Program to Generate and Print Fibonacci series upto a given inputted number

 C Program to Generate and Print Fibonacci series upto a given inputted number     In this example, we will generate and print fibonacci series upto a the upper limit entered by the user. To solve this problem we should have a proper concept on Fibonacci series and while loop.  What is a Fibonacci Series? Fibonacci series is the sum of the two preceding numbers, starting from 0 and 1.     For Example: 0,1,1,2,3,5,8,13,....,etc  PROGRAM #include <stdio.h> #include <conio.h> void   main () {      int   n , x1 , x2 , x3 = 0 ;      printf ( "Enter the limit upto which fibonacci series to be generated : " );      scanf ( " %d " ,& n );      x1 = 0 ;      x2 = 1 ;      printf ( " %d \t %d " , x1 , x2 );      x3 = x1 + x2 ;      while ( x3 <= n )     {          printf ( " \t %d " , x3 );          x1 = x2 ;          x2 = x3 ;          x3 = x1 + x2 ;     }      getch (); } OUTPUT: Enter the limit upto which fibonacci series to be g