Saturday, May 27, 2023
HomeFun With ProgrammingProgramsGenerate Multiplication Table Of Given Number In C Programming

Generate Multiplication Table Of Given Number In C Programming

hello, friends today in this Multiplication Program In C we will see how we can generate the table of the given number by the user.

Multiplication Program In C

tablegeneration.c

#include<stdio.h>
int main()
{
    int num;//ye wo number hoga jiska table user ko genarte karna hai
    int i; //ye 1 se lekar 10 tak ke number ke liye hai
    //sabse pahle user se input lenge
    printf("enter the number whose table you want to generate\n");
    scanf("%d",&num);
    //uske badd for loop chalenge taki hum 10 tak ke ans ko print kar ske
      printf("the table of %d is\n",num);
    for(i=1;i<=10;i++)
    {
      
        printf("%d*%d = %d\n",num,i,num*i);
       
    }
     return 0;
   
}
  • In the above C program first of all we included the header file.
  • After that, I declared two variables that are num, i.
  • num is for taking the input from the user and i is for running the loop.
  • After that,
  • we will run the loop and multiply the value of I by the number whose tables we want to generate.

Output Of The Program

D:\C-Program>gcc tablgeneration.c

D:\C-Program>.\a.exe
enter the number whose table you want to generate
3
the table of 3 is
3*1 = 3
3*2 = 6
3*3 = 9
3*4 = 12
3*5 = 15
3*6 = 18
3*7 = 21
3*8 = 24
3*9 = 27
3*10 = 30

I hope you will understand how we can do this program in C. Thank you keep visiting rkrknowledge.com.

You May Also Read

Suhashini Mishra
Suhashini Mishrahttps://rkrknowledge.com/
Suhasini Mishra from India passionate UI UX Developer | Content Writer | Content Researcher | Ionic Developer

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -

Stay Connected

33FansLike
60FollowersFollow
520SubscribersSubscribe

Most Popular

Recent Comments