3. Program that generates the following output: 10 20 19 Use an integer constant for the 10, an arithmetic assignment operator to generate the 20, and a decrement operator to generate 19.

Chapter 2: 

C++ Programming Basics 

Programming Exercise

Problem # 3:

Write a program that generates the following output:
10
20
19
Use an integer constant for the 10, an arithmetic assignment operator to generate the 20, and a decrement operator to generate 19.

Solution:

#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
    const int a =10;
    cout<<a<<endl;
    int b=a+10;
    cout<<b<<endl;
    int c=--b;
    cout<<c;
  
    return 0;
}

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

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


Comments