Write a C C++ program to find multiplication table

 

Flowchart

Multiplication table of given number flowchart

 

Coding in C

#include<stdio.h>
int main()
{
int num,c=1,res;
printf(“Enter a number: “);
scanf(“%d”,&num);
while(c<=10)
{
res=num*c;
printf(“%d*%d=%d\n”,num,c,res);
c++;
}
return 0;
}

 

Coding in C++

#include<iostream>
using namespace std;
int main()
{
int num,c=1,res;
cout<<“Enter a number: “;
cin>>num;
while(c<=10)
{
res=num*c;
cout<<num<<“*”<<c<<“=”<<res<<“\n”;
c++;
}
return 0;
}

 

Output

Multiplication table of given number output

 

Published by

admin

I am a computer teacher, programmer and web developer