F Multiplication table of a number in CPP using Function | CodeTheta

Multiplication table of a number in CPP using Function


Code :
#include<iostream>
#include<conio.h>
using namespace std;

int TableFunction(int);

int main() {
    int n, Result;
    cout<<"Enter a Number: ";
    cin>>n;  
    Result = TableFunction(n);
}

int TableFunction(int x) {
    int i,Output;
    for (i=1; i<=10;i++) {
        Output = x * i;
        cout<<x<<"*"<<i<<"="<<Output<<endl;
    }
}


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

IDE Used To Test This Code : DEV C++.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Post a Comment