Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?..

Answer / shanthi

122

Is This Answer Correct ?    2 Yes 3 No

void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?..

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

void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?..

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

void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?..

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

void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?..

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

void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?..

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

void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?..

Answer / sam

first the initial value of i is 1
i++ is post decremented so,i++ must be 1

final value is " 1 2 1"

Is This Answer Correct ?    1 Yes 3 No

void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?..

Answer / ramya

OUTPUT:
1,2,1

Is This Answer Correct ?    0 Yes 2 No

void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?..

Answer / pratik

answer is 1 1 2 ..
it is an example of stack type ..

Is This Answer Correct ?    0 Yes 4 No

void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?..

Answer / ismail ns

1 1 2

Is This Answer Correct ?    1 Yes 8 No

Post New Answer

More C C++ Errors Interview Questions

who was the present cheif governor of reserve bank of india

6 Answers   State Bank Of India SBI,


quoroum of computer languages?

0 Answers   Infosys,


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 .

3 Answers  


Using string functions write a program that will accept the name of the capital as input value and will display the corresponding country. ------------------------ Capitals Countries ------------------------ Capitals Countries Ottawa Canada Moscow Russia Rome Italy I can't not get it to run properly

1 Answers   AMA,


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.

3 Answers  


2. A student studying Information Technology at Polytechnic of Namibia is examined by coursework and written examination. Both components of assessment carry a maximum of 50 marks. The following rules are used by examiners in order to pass or fail students. a. A student must score a total of 40% or more in order to pass (total = coursework marks + examination marks) b. A total mark of 39% is moderated to 40% c. Each component must be passed with a minimum mark of 20/50. If a student scores a total of 40% or more but does not achieve the minimum mark in either component he/she is given a technical fail of 39% (this mark is not moderated to 40%) d. Grades are awarded on marks that fall into the following categories. Mark 100-70 69-60 59-50 49-40 39-0 Grade A B C D E Write a program to input the marks for both components (coursework marks out of 50 and examination marks out of 50), out put the final mark and grade after any moderation. [30]

0 Answers  


how to convert decimal to binary in c using while loop without using array

50 Answers   Apple, Aptech, Arwen Tech, BCS, C2D Software, CEC,


void main() { int i=7; printf("N= %*d",i,i); }

6 Answers   HCL,


Write a C program to enter 10 integer numbers through one variable and count how many of them are even using while loop ?

2 Answers  


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............

1 Answers  


difference between c/c++ programing language? what is necessesity of c++ when existing c programing language?

2 Answers   TCS,


To generate the series 1+3+5+7+... using C program

18 Answers  


Categories