Answer to Question #24286 in C++ for gaurav chauhan

Question #24286
how can i print a multiplication table of 7
1
Expert's answer
2013-02-13T09:39:29-0500
#include <conio.h>
#include <iomanip>
#include <iostream>

using namespace std;

/* Prints the row separator */
void print_separator()
{
for (int n = 0; n < 59; n++)
cout << "-";
cout << endl;
}

void main()
{
/* Print the table header */
cout << " |";
for (int n = 0; n <= 10; n++)
cout << setw(3) << n << " |";

cout << endl;
print_separator();

/* Print the table body */
cout << " 7 |";
for (int n = 0; n <= 10; n++)
cout << setw(3) << n * 7 << " |";

cout << endl;
print_separator();

_getch();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS