find the output of given code.#include <stdio.h>int main(){int a,b=110,c=20;printf("%d",a=b-=c*=5);return 0;}
Question
find the output of given code.#include <stdio.h>int main(){int a,b=110,c=20;printf("%d",a=b-=c*=5);return 0;}
Solution
The given code is written in C language. Here's a step-by-step explanation of what the code does:
-
It declares three integer variables
a,b, andcwithbinitialized to 110 andcinitialized to 20. -
The expression
c*=5is equivalent toc = c * 5. So,cbecomes 100. -
The expression
b-=cis equivalent tob = b - c. So,bbecomes 10 (110 - 100). -
The expression
a=bassigns the value ofbtoa. So,abecomes 10. -
The
printffunction prints the value ofa, which is 10.
So, the output of the given code will be 10.
Similar Questions
What will be the output of the following code?
What will be the output of the following program?
What will be the output of the following C code?
What will be the output of the following C++ code?
What is the output for the following code?Note: This question helps in clearing conceptual technical interviews for service-based companies.
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.