Computer scienceProgramming languagesC++Operators and expressions

Increment and decrement operators

Multiple of three

Report a typo

Write/modify C++ code below using only prefix increment operator such that the output of the below form is printed.

Input: number

Output: First line: Use prefix increment on number and then obtain a multiple of 3.
Second line: The value of number.

Sample Input 1:

2

Sample Output 1:

9
3

Sample Input 2:

7

Sample Output 2:

24
8

Sample Input 3:

16

Sample Output 3:

51
17
Write a program in C++
#include<iostream>

int main() {
int number;
cin >> number;

// Enter your code here

}

Create a free account to access the full topic