63 155
Assignments Done
99,3%
Successfully Done
In July 2018

Answer to Question #7483 in C++ for hadi

Question #7483
#include<stdio.h>
#include<conio.h>
main()
{
int i=3,r;
r=(i*10) + ++i;
printf("%d",r);
getch();
}
result must be 33 but is 44.
Expert's answer
The result is 44 because the first operation is performed the increment (++i), for then theresult was 33 need remove the increment or write it like this: i++.





#include<stdio.h>

#include<conio.h>

main()

{

int i=3,r;

r=(i*10) + i;

printf("%d",r);

getch();

}




or this, if you need to increment "i":





#include<stdio.h>

#include<conio.h>

main()

{

int i=3,r;

r=(i*10) + i++;

printf("%d",r);

getch();

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions