0% found this document useful (0 votes)
14 views2 pages

Problem - 1 Solution

Uploaded by

Zakaria Zakaria
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

Problem - 1 Solution

Uploaded by

Zakaria Zakaria
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Problem # 1/2 Solution Using C++

#include <iostream>
using namespace std;

void PrintTableHeader()
{
cout << "\n\n\t\t\t Multipliaction Table From 1 to 10\n\n";
cout << "\t";

for (int i = 1; i <= 10; i++)


{
cout << i << "\t";
}
cout << "\n___________________________________________________________________________________\n";
}

string ColumSperator(int i)
{
if (i < 10)
return " |";
else
return " |";
}

void PrintMultiplicationTable()
{
PrintTableHeader();

for (int i = 1; i <= 10; i++)


{
cout << " " << i << ColumSperator(i) << "\t";
for (int j = 1; j <= 10; j++)
{
cout << i * j << "\t";

}
cout << endl;
}

int main()
{

PrintMultiplicationTable();

}
ProgrammingAdvices.com
© Copyright 2022

You might also like