Challenge: Let C++ Do the Maths

Lab C++ Beginner 10 points

Print the line 12 + 30 = 42. Write the text 12 + 30 = in quotes, but let C++ calculate the 42 from 12 + 30.

Input

None.

Output

One line: 12 + 30 = 42

Example

Output

12 + 30 = 42
Sample output available
Editor
C++

Hints

Chain two pieces with <<: the text, then the sum.

Don't put quotes around 12 + 30 the second time.

Solution explanation

Text in quotes is printed as it is. 12 + 30 without quotes is worked out first, so 42 is printed.

Show solution
#include <iostream>
using namespace std;

int main() {
    cout << "12 + 30 = " << 12 + 30 << "\n";
    return 0;
}
Output
Answer
HOME LABS COMMUNITY DASHBOARD