#include<stdio.h>
void main()
{
int i=1;
printf("%d%d%d",i++,++i,i);
}
Answers were Sorted based on User's Feedback
Answer / vinod
3 2 1.because the print f function print right to leftand
the compiler reads left to right.thus answer is 3 2 1
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / shruti
the answer will be:-
1,3,3
as i++ is postfix so first it will print the value then
increament..
after first increament the second preincreament comes and
the value becomes 3..
third time also it will 3..
| Is This Answer Correct ? | 4 Yes | 5 No |
Answer / aaradhana
1,2,2
since to print the postincremented value then i takes the
value 1 then gets preincremented by1 & takes i=2.To print i
value then it takes the updated value i=2.
| Is This Answer Correct ? | 1 Yes | 3 No |
Answer / ramya
Answer is 133.
first the compiler prints 'i' value and prints the value,
next it increments the 'i' value and then prints its value.
| Is This Answer Correct ? | 8 Yes | 14 No |
Answer / priyadarshan kasta
1 2 2
becoz, this line will execute frm right to left side.
that is, first i=1, then ++i will be 2 and then i++ will be
printed as 2. So , it will print as 1 2 2(i.e i++,++i,i)
| Is This Answer Correct ? | 1 Yes | 10 No |
write a profram for selection sort whats the error in it?
How to develop a program using C language to convert 8-bit binary values to decimals. TQ
What is the code for following o/p * * * * * * * * * * * * * * * *
void main() { int i=5; printf("%d",i+++++i); }
#include<stdio.h> void main() { int i=1; printf("%d%d%d",i++,++i,i); }
what is meant for variable not found?
How to create a program that lists countries capitals when country is entered? (Terribly sorry, I'm a complete novist to coding with C, am looking for inspiration and general tips on how to code and create this program.)
How to convert hexadecimal to binary using c language..
1 Answers Bajaj, GAIL, Satyam, Zenqa,
Given that two int variables, total and amount , have been declared, write a sequence of statements that: initializes total to 0 reads three values into amount , one at a time. After each value is read in to amount , it is added to the value in total (that is, total is incremented by the value in amount ). Instructor's notes: If you use a loop, it must be a for loop. And if you use a loop control variable for counting, you must declare it.
Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have already been declared, use a do...while loop to compute the sum of the cubes of the first n whole numbers, and store this value in total . Thus if n equals 4, your code should put 1*1*1 + 2*2*2 + 3*3*3 + 4*4*4 into total . Use no variables other than n , k , and total .
void main() { int i=5,y=3,z=2,ans; clrscr(); printf("%d",++i + --z + i++ + --i * ++y); i=5,y=3,z=2; ans=++i + --z + i++ + --i * ++y; printf("\n%d",ans); getch(); } Its output is 37 and 31.... Please explain me why its different How it works.....
main() { char c; for(c='A';c<='Z';c++) getch(); }