Write a program that takes a number from the user and pass that number to a user defined function. The function displays the table of that number. (
#include <iostream>
#include<conio.h>
using namespace std;
void table(int,int);
void main(void)
{
int num,i;
cout << "Enter the number : " << endl;
cin >> num;
cout << "Upto how many multiples of the given number do you want? " << endl;
cin >> i;
table(num,i);
getch();
}
void table(int num,int i)
{
for(int j=1;j<=i;j++)
printf("%5d * %5d = %5d",j,num,j*num);
}
Comments
Leave a comment