Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
int a;
6.
a = 5 + 3 * 5;
7.
cout
Options:
A .  35
B .  20
C .  25
D .  30
Answer: Option B

Because the * operator is having highest precedence, So it is executed first and then the + operator 

will be executed.
Output:
$ g++ op1.cpp
$ a.out
20



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers