This program generates multiplication tables for a given number up to a specified limit. The tables function takes no arguments and returns no value. It prompts the user to enter the table number and the limit, then uses a for loop to iterate from 1 up to the limit and prints out each multiplication table entry. The main function simply calls the tables function and returns 0.
#include<iostream> using namespace std; void tables(); int main() { tables(); return 0; } void tables() { int i,j,n; cout<<"\nEnter the Table number:"; cin>>j; cout<<"\nEnter the limit:"; cin>>n; for(i=1;i<=n;i++) { cout<<"\n"<<i<<"*"<<j<<"="<<i*j; } }To download raw file Click Here
Enter the Table number:10 Enter the limit:10 1*10=10 2*10=20 3*10=30 4*10=40 5*10=50 6*10=60 7*10=70 8*10=80 9*10=90 10*10=100
The program is an example of using a function with parameters. The main function asks the user for a table number (j) and a limit (n) and then calls the tables function with these values as arguments.
The tables function takes two parameters, j and n, and uses them to print out the multiplication table of j up to the limit n. The function uses a loop to iterate through the numbers 1 to n and print out each multiplication. Finally, the main function returns 0 to indicate successful program execution.
#include<iostream> using namespace std; void tables(int,int); int main() { int i,j,n; cout<<"\nEnter the Table number:"; cin>>j; cout<<"\nEnter the limit:"; cin>>n; tables(j,n); return 0; } void tables(int j,int n) { int i; for(i=1;i<=n;i++) { cout<<"\n"<<i<<"*"<<j<<"="<<i*j; } }To download raw file Click Here
Enter the Table number:10 Enter the limit:10 1*10=10 2*10=20 3*10=30 4*10=40 5*10=50 6*10=60 7*10=70 8*10=80 9*10=90 10*10=100
This program allows the user to input a number (which represents a multiplication table) and a limit, and then prints out the multiplication table up to that limit. The program contains a function tables() which prompts the user to input a table number and limit, and then uses a for loop to print out the multiplication table up to that limit. The main() function calls the tables() function to run the program.
#include<iostream> using namespace std; void tables(); int main() { tables(); return 0; } void tables() { int i,j,n; cout<<"\nEnter the Table number:"; cin>>j; cout<<"\nEnter the limit:"; cin>>n; for(i=1;i<=n;i++) { cout<<"\n"<<i<<"*"<<j<<"="<<i*j; } }To download raw file Click Here
Enter the Table number:10 Enter the limit:10 1*10=10 2*10=20 3*10=30 4*10=40 5*10=50 6*10=60 7*10=70 8*10=80 9*10=90 10*10=100
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions