Multiplication table using functions

hello guys:::
how to print a multiplication table of 2,3 ,4 or any table using functions in c++.. ??? Can anybody solve this please....

Remember using "Functions" e.g Multiplication(int x)
{ }
int main{
then call the function}
Last edited on
The return type on line 9: it's an int, but it should be float.
Thank you so much for your kind help.. it works now,,,, thank youuu.... but the same problem in the below program also,, what to do?

#include <iostream>

using namespace std;

int main()

int b,c,d,e=0,total=300, sum=0.0;
float percentage=0;
string a;
cout<<"******Welcome to the Student Grading Calculation System******" <<endl;
cout<< "Do you want to Calculate your Grades?"<<endl;
cout<<"Enter y for yes or n for no" <<endl;
cin>> a;
cout<<"Enter your Math Marks \n";
cin>> b;
cout<<"Enter your Science Marks \n";
cin >> c;
cout<<"Enter your English Marks \n";
cin>> d;
sum = b+c+d;
cout<< "your Obtained marks are = " << sum <<endl;
percentage = sum*100/total;
cout << "Percentage = " << percentage << "%" << endl;
cout<<"Do you want Further Calculation of your Grades ? " << endl;
}else {
cout <<"Thank you so much for using Student Calculation System " << endl;
return 1;


return 0;

remember this rule:

If you want something to be returned as a float, first of all initialize it as float, i.e 0.0 and not 0.

Second when you are doing sum*100/total, and you want a float , do like this

Finally if you want floats use floats otherwise use ints.
Topic archived. No new replies allowed.