Code
#include <iostream>
#include <stdlib.h>
using namespace std;
void Clear()
{
#if defined _WIN32
system("cls");
#elif defined (__LINUX__) || defined(__gnu_linux__) || defined(__linux__) || defined (__APPLE__)
system("clear");
#endif
}
int main()
{
int j, i, n;
cout << "\n Input the number upto 10: ";
cin >> n;
Clear();
cout << "\nMultiplication table from 1 to " << n << endl;
;
cout << "--------------------------------------------------------------------------------\n";
for (i = 1; i <= 10; i++)
{
for (j = 1; j <= n; j++)
{
if (j <= n - 1)
cout << j << "x" << i << "=" << i * j << " ";
else
cout << j << "x" << i << "=" << i * j << " ";
}
cout << endl;
}
cout << '\n' << '\n';
system("pause");
cout << "\n\nPress the enter key to exit";
return 0;
}
