Q:

C Program To Print Multiplication Table (5 Different Ways)

belongs to collection: Basic C Programming Examples

0

you have to make this program in the following way:

  • C program to print multiplication table using for loop
  • C program to print multiplication table using while loop
  • C program to print multiplication table using function
  • C program to print multiplication table using recursion
  • C program to print multiplication table from 1 to 10

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

C Program To Print Multiplication Table of a Given Number Using For Loop

Algorithm

  1. Program Start
  2. Declaration of variable
  3. Input numbers or Values
  4. Assign the value in variable
  5. Check condition
  6. Give answer according to condition
  7. Program Stop

Program

//C Program To Print Multiplication Table Using For Loop

#include<stdio.h>
int main()
{
   int num,i;
   printf("enter a number");
   scanf("%d",&num);

   for(i=1;i<=10;i++)
   {
       printf("%d*%d = %d\n",num,i,num*i);
   }
return 0;
}

Output

Enter a number 5
5*1 = 5
5*2 = 10
5*3 = 15
5*4 = 20
5*5 = 25
5*6 = 30
5*7 = 35
5*8 = 40
5*9 = 45
5*10 = 50

C Program To Print Multiplication Table Using While Loop

Program

//C Program To Print Multiplication Table Using While Loop

#include<stdio.h>
int main()
{
   int num,i=1;
   printf("enter a number");
   scanf("%d",&num);

   while(i<=10)
   {
       printf("%d*%d = %d\n",num,i,num*i);
       i++;
   }
return 0;
}

Output

Enter a number 10
10*1 = 10
10*2 = 20
10*3 = 30
10*4 = 40
10*5 = 50
10*6 = 60
10*7 = 70
10*8 = 80
10*9 = 90
10*10 = 100

C Program To Print Multiplication Table Using Function

Algorithm

  1. Program Start
  2. Declaration of variable
  3. Input numbers or Values
  4. Assign the value in variable
  5. Calling Function
  6. Check condition
  7. Give answer according to condition
  8. Program Stop

Program

//C Program To Print Multiplication Table Using Function

void multi(int num)
{ int i;
    for(i=1;i<=10;i++)
   {
       printf("%d*%d = %d\n",num,i,num*i);
   }
}
#include<stdio.h>
int main()
{
   int n;
   printf("Enter a number : ");
   scanf("%d",&n);

   multi(n);
  return 0;
}

Output

Enter a number : 2
2*1 = 2
2*2 = 4
2*3 = 6
2*4 = 8
2*5 = 10
2*6 = 12
2*7 = 14
2*8 = 16
2*9 = 18
2*10 = 20

C Program To Print Multiplication Table Using Recursion

Program

#include<stdio.h>

int mul(int n,int i);
void main()
{
    int n,i=1;
    printf("enter a number\n");
    scanf("%d",&n);
    mul(n,i);
}
int mul(int n,int i)
{
    if(i>10)
    {
        return 0;
    }
    else
    {
        printf("%d*%d=%d\n",n,i,n*i);
        return mul(n,i+1);
    }
}

Output

enter a number
3
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

C Program To Print Multiplication Table From 1 To 10

Program

//C Program To Print Multiplication Table From 1 To 10

#include<stdio.h>

void main()
{
	 int i, j;

	 for(i=1;i<=10;i++)
	 {
		  for(j=1;j<=10;j++)
		  {
			   printf("%d*%d = %d\t", i, j, i*j);
		  }
		  printf("\n");
	 }

}

Output

1 x 1 = 1	1 x 2 = 2	1 x 3 = 3	1 x 4 = 4	1 x 5 = 5	
1 x 6 = 6	1 x 7 = 7	1 x 8 = 8	1 x 9 = 9	1 x 10 = 10	

2 x 1 = 2	2 x 2 = 4	2 x 3 = 6	2 x 4 = 8	2 x 5 = 10	
2 x 6 = 12	2 x 7 = 14	2 x 8 = 16	2 x 9 = 18	2 x 10 = 20	

3 x 1 = 3	3 x 2 = 6	3 x 3 = 9	3 x 4 = 12	3 x 5 = 15	
3 x 6 = 18	3 x 7 = 21	3 x 8 = 24	3 x 9 = 27	3 x 10 = 30	

4 x 1 = 4	4 x 2 = 8	4 x 3 = 12	4 x 4 = 16	4 x 5 = 20	
4 x 6 = 24	4 x 7 = 28	4 x 8 = 32	4 x 9 = 36	4 x 10 = 40	

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	

6 x 1 = 6	6 x 2 = 12	6 x 3 = 18	6 x 4 = 24	6 x 5 = 30	
6 x 6 = 36	6 x 7 = 42	6 x 8 = 48	6 x 9 = 54	6 x 10 = 60	

7 x 1 = 7	7 x 2 = 14	7 x 3 = 21	7 x 4 = 28	7 x 5 = 35	
7 x 6 = 42	7 x 7 = 49	7 x 8 = 56	7 x 9 = 63	7 x 10 = 70	

8 x 1 = 8	8 x 2 = 16	8 x 3 = 24	8 x 4 = 32	8 x 5 = 40	
8 x 6 = 48	8 x 7 = 56	8 x 8 = 64	8 x 9 = 72	8 x 10 = 80	

9 x 1 = 9	9 x 2 = 18	9 x 3 = 27	9 x 4 = 36	9 x 5 = 45	
9 x 6 = 54	9 x 7 = 63	9 x 8 = 72	9 x 9 = 81	9 x 10 = 90	

10 x 1 = 10	10 x 2 = 20	10 x 3 = 30	10 x 4 = 40	10 x 5 = 50	
10 x 6 = 60	10 x 7 = 70	10 x 8 = 80	10 x 9 = 90	10 x 10 = 100

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Basic C Programming Examples

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
C Program To Find Factorial of a Number... >>
<< C Program To Find Fibonacci Series (5 Different Wa...