fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.  
  8. int input;
  9.  
  10. cout << "Enter Value: ";
  11. cin >> input;
  12. cout << "Loop Counter" << setw(20) << "Number Entered" << setw(14) << "Product" << endl;
  13.  
  14. for(int counter = 1; counter <= 10; counter++)
  15.  
  16. {
  17. int product = input * counter;
  18.  
  19. if (product < 10 && counter != 10)
  20. cout << setw(6) << counter << setw(17) << input << setw(17) << product << endl;
  21. else if (product > 10 && counter != 10)
  22. cout << setw(6) << counter << setw(17) << input << setw(18) << product << endl;
  23. else
  24. cout << setw(7) << counter << setw(16) << input << setw(18) << product << endl;
  25. }
  26. cout<<setfill('_')<<setw(45)<<"_"<<endl;
  27. }
Success #stdin #stdout 0s 3300KB
stdin
5
stdout
Enter Value: Loop Counter      Number Entered       Product
     1                5                5
      2               5                10
     3                5                15
     4                5                20
     5                5                25
     6                5                30
     7                5                35
     8                5                40
     9                5                45
     10               5                50
_____________________________________________