void main()
{
int i=1;
printf("%d%d%d",i,++i,i++);
}
Cau u say the output....?
Answers were Sorted based on User's Feedback
Answer / subash
221
because it starts executing from right to left
so it first executes i++(the increment will happen when
entire printf statement is executed so now ++i which means
it is the pre incremant so now i becomes 2
| Is This Answer Correct ? | 2 Yes | 3 No |
Answer / kiran
The output will be 1 2 2...
First the assigned value of i(1) is printed. Then (++i) prints the Incremented value of i which is 2 will be printed.
Now as the Postfix operator only prints thhe value first and then increments...so the value of i is again 2..
| Is This Answer Correct ? | 4 Yes | 5 No |
Answer / we r the new inventors
the explanation above are also correct but think they are somewhat wrong because it was post increment of i.so value of i will become 2..
| Is This Answer Correct ? | 1 Yes | 2 No |
Answer / we are the new inventors
above answers are also right but i think they are somewhat wrong..because its a post increment of i so ans will become 2...
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / sums
The ans is obv 3 3 1...
The explanations given are also correct
For all those u r giving other answers without even giving the reason should at least run the program in "gcc" before writing anything
| Is This Answer Correct ? | 2 Yes | 4 No |
Answer / pratik
answer is 1 1 2 ..
it is an example of stack type ..
| Is This Answer Correct ? | 0 Yes | 4 No |
Write a c-programe that input one number of four digits and find digits sum?
void main() { int i=7; printf("N= %*d",i,i); }
Given an int variable n that has already been declared and initialized to a positive value, and another int variable j that has already been declared, use a do...while loop to print a single line consisting of n asterisks. Thus if n contains 5, five asterisks will be printed. Use no variables other than n and j .
What is the code for following o/p * * * * * * * * * * * * * * * *
Find the error (2.5*2=5) (a) X=y=z=0.5,2.0-5.75 (b) s=15;
what is exceptions?
#include"stdio.h" #include"conio.h" void main() { int a; printf("\n enter a number:"); scanf("%c\n"); getch(); }
To generate the series 1+3+5+7+... using C program
what is syntax error?
WHAT WILL BE THE OUTPUT OF THE FOLLOWING QUESTION void main() { int x=4,y=3,z; z=x-- -y; printf("%d%d%d",x,y,z); }
when i use cout or cin call & then either << or >> .....it shows declaration syntax error...what should i do? cout<<"anything"; int a; cin>>a; return 0;
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 .