2. Program that generates the following table using a single cout statement for all output.

Chapter 2: 

C++ Programming Basics 

Programming Exercise

Problem # 2:

Write a program that generates the following table:
1990      135
1991     7290
1992    11300
1993    11300
Use a single cout statement for all output.

Solution:

#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
    cout<<"1990 \t 135 \n1991 \t 7290\n1992 \t 11300\n1993 \t 11300\n";
  
    return 0;
}

Code Screenshot:

C++ Programming Basics, Chapter 2, Coding tutorial, Computer Science, Exercise Solution, Object Oriented Programming in C++, Programming for beginners, Programming Tutorial

  Output:

C++ Programming Basics, Chapter 2, Coding tutorial, Computer Science, Exercise Solution, Object Oriented Programming in C++, Programming for beginners, Programming Tutorial

Let me know in the comment section if you have any question.

Previous Post:
1. Program that asks the user to enter a number of gallons, and then displays the equivalent in cubic feet.


Comments