main()

{

unsigned int i=10;

while(i-->=0)

printf("%u ",i);

}

Answers were Sorted based on User's Feedback



main() { unsigned int i=10; while(i-->=0) printf("%u ",i); }..

Answer / susie

Answer :

10 9 8 7 6 5 4 3 2 1 0 65535 65534…..

Explanation:

Since i is an unsigned integer it can never become negative.
So the expression i-- >=0 will always be true, leading to
an infinite loop.

Is This Answer Correct ?    25 Yes 5 No

main() { unsigned int i=10; while(i-->=0) printf("%u ",i); }..

Answer / renu

9 8 7 6 5 4 3 2 1 0 424 4235

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More C Code Interview Questions

Derive expression for converting RGB color parameters to HSV values

1 Answers  


How we print the table of 3 using for loop in c programing?

7 Answers  


main() { int i = 0xff ; printf("\n%d", i<<2); } a. 4 b. 512 c. 1020 d. 1024

2 Answers   HCL,


Is this code legal? int *ptr; ptr = (int *) 0x400;

1 Answers  


What is "far" and "near" pointers in "c"...?

3 Answers  






main() { printf("%d", out); } int out=100;

3 Answers  


How to reverse a String without using C functions ?

33 Answers   Matrix, TCS, Wipro,


In a gymnastic competition, scoring is based on the average of all scores given by the judges excluding the maximum and minimum scores. Let the user input the number of judges, after that, input the scores from the judges. Output the average score. Note: In case, more than two judges give the same score and it happens that score is the maximum or minimum then just eliminate two scores. For example, if the number of judges is 5 and all of them give 10 points each. Then the maximum and minimum score is 10. So the computation would be 10+10+10, this time. The output should be 10 because 30/3 is 10.

0 Answers   TCS,


main() { void swap(); int x=10,y=8; swap(&x,&y); printf("x=%d y=%d",x,y); } void swap(int *a, int *b) { *a ^= *b, *b ^= *a, *a ^= *b; }

2 Answers  


Write a c program to search an element in an array using recursion

1 Answers   Wipro,


create a login program that ask username and password. if you input username or password 3 times wrong, the program will terminate else the program will prompt a message "congratulations"

2 Answers  


posted by surbhi just now main() { float a = 5.375; char *p; int i; p=(char*)&a; for(i=0;i<=3;i++) printf("%02x",(unsigned char) p[i]); } how is the output of this program is :: 0000ac40 please let me know y this output has come

2 Answers   GATE,


Categories