void main()
{
int i=5;
printf("%d",i+++++i);
}
Answers were Sorted based on User's Feedback
Answer / nagarajan
If it is i++ + ++i the output will be 12 because
i++ =6
++1 =6
6+6=12
but in this case continuous five plus will show error .
compiler cannot identify operands there must be a space in between
| Is This Answer Correct ? | 55 Yes | 21 No |
Answer / junaid
well if you write all 5+ without space then it will give an error because compiler will not recognize it
you can write i++ + ++i or ++i + i++
answer in both statements will be 12
| Is This Answer Correct ? | 16 Yes | 7 No |
Answer / harshawardhan
all functions pass the value from right to left and printf()
is one function therefore
i++ + ++i
in this siquence first solve the ++i and then solve the i++
first incrment by one i.e. 6 and then it solve i++ i.e. 5
printf("%d",i++ + ++i);
printf("%d",i++ + 6);
printf("%d",6 + 6);
printf("%d",12);
And therefoe output is:-
12
| Is This Answer Correct ? | 13 Yes | 9 No |
Answer / gaurav tyagi
first of all
i want to say every one plz write ans if you are fully confident otherwise run it
///in this program a error is occurs because compiler not recognize the code <i am run this one>
| Is This Answer Correct ? | 3 Yes | 3 No |
Answer / srinivas
printf allways it will work from right to left so first
++i=6 after that i++ also 6 so 6+6=12 ..
| Is This Answer Correct ? | 9 Yes | 10 No |
Answer / vns
Increment operator(++i) only increases i value. At first ++i, i value becomes 6. Then there's another ++i, now i value is 7. both increment operations are evaluated since it has higher precedence than addition. So (++i) +(++i)= (i)+(i)= 7+7=14.
compile and run the program and you will get 14.
| Is This Answer Correct ? | 1 Yes | 2 No |
Answer / taruna
plzzz explain this ...why can't its answer be 12..???
plzz give proper explaination....waitin!!!
| Is This Answer Correct ? | 4 Yes | 7 No |
#include"stdio.h" #include"conio.h" void main() { int a; printf("\n enter a number:"); scanf("%c\n"); getch(); }
Write a c-programe that input one number of four digits and find digits sum?
Declaration of Cube Guys please help me.. Is this a right way to declare cube.? If i Compile it. It Says: Cube undeclared what should i do? Please help \thanks in advanced #include<stdio.h> #include<math.h> #include<conio.h> main( ) { float x,y; while(x++<10.0) { printf("Enter Number:"); scanf("%d", &x); y = cube(x); printf("%f %f %f \n", x,pow(x,2),y); cube(x); } { float x; float y; y = x*x*x; } getch(); return (y); }
how to convert decimal to hexadecimal without using arrays just loops
To generate the series 1+3+5+7+... using C program
Assume that the int variables i and j have been declared, and that n has been declared and initialized. Write code that causes a "triangle" of asterisks of size n to be output to the screen. Specifically, n lines should be printed out, the first consisting of a single asterisk, the second consisting of two asterisks, the third consistings of three, etc. The last line should consist of n asterisks. Thus, for example, if n has value 3, the output of your code should be * ** *** You should not output any space characters. Hint: Use a for loop nested inside another for loop.
what is meant for variable not found?
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 .
#include<stdio.h> void main() { int i=1; printf("%d%d%d",i++,++i,i); }
how tally is useful?
Given that two int variables, total and amount, have been declared, write a loop that reads integers into amount and adds all the non-negative values into total. The loop terminates when a value less than 0 is read into amount. Don't forget to initialize total to 0. Instructor's notes: This problem requires either a while or a do-while loop.
Answering Yes or No in C++...using only stdio.h and conio.h..........help me please...? here's must be the output of the program: Screen A Exam No. items Score 1 20 20 2 35 35 Another Entry? [Y] or [N] : Screen B: Record No. Student's Name: 1 Fernando Torres 2 Chuck Norris Note: if you press Y, the program must repeat the procedure in screen A, then if N, the program must proceed to the screen B....Please Help me out............