Welcome !!!

Today in this blog we are going to learn how to write a program to find the multiplication table of any number in C language. In order to understand this blog, I prefer you to learn about loops in C, so that you can understand better. In this program we are going to use “for loop”.

Knowledge Chatter
Concept: -

First, we will define an integer n. Then take input from user by using scanf( ).

--> scanf(“%d”, &n);

And then the most important thing i.e. the for loop. Syntax of for loop is: 

--> for(….condition….){

       ………..code……… }

The condition that we will write here is (int i=1; i<=10; i++.). So here if you want you can declare i as an integer along with the integer n. But instead of doing that I declare it here itself in the condition. Moving forward i is the number that is going to get multiplied by the number user provide i.e. from 1 to 10.

Solution: -

Knowledgechatter

#include<stdio.h>

int main(){

               int n;

               printf("Enter the number n: ");

               scanf("%d", &n);

               for(int i=1; i<=10; i++){

                              printf(" %d * %d = %d\n", n, i, n*i);

               }

               return 0;

}

 Above I have provided image and textual form of the solution. I hope that you won’t just copy paste instead try to understand the code.

Well, that’s it here is the solution and if you have any difficulty in understanding any line of the code, feel free to ask me in the comment section

And if there is any mistake feel free to correct me and let me know in the comment section.

If you liked my blog, you can also visit the following link for similar content: - 

Hello world in C - HackerRank Solution

Sum and Difference of two no. in C - HackerRank Solution

Input and Output in C++ - HackerRank Solution

Greatest of 3 numbers in C