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

write a program to count the number the same (letter/character foreg: 's') in a given sentence.

2 Answers  


main() { int i, j; scanf("%d %d"+scanf("%d %d", &i, &j)); printf("%d %d", i, j); } a. Runtime error. b. 0, 0 c. Compile error d. the first two values entered by the user

2 Answers   HCL,


main() { char *p; p="Hello"; printf("%c\n",*&*p); }

1 Answers  


why is printf("%d %d %d",i++,--i,i--);

4 Answers   Apple, Cynity, TCS,


what is the output of the below program & why ? #include<stdio.h> void main() { int a=10,b=20,c=30; printf("%d",scanf("%d%d%d",&a,&b,&c)); }

6 Answers   CSC, IIIT,






how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.

0 Answers   Mbarara University of Science and Technology,


main() { int i=1; while (i<=5) { printf("%d",i); if (i>2) goto here; i++; } } fun() { here: printf("PP"); }

1 Answers  


void main() { int k=ret(sizeof(float)); printf("\n here value is %d",++k); } int ret(int ret) { ret += 2.5; return(ret); }

1 Answers  


#include<stdio.h> main() { const int i=4; float j; j = ++i; printf("%d %f", i,++j); }

1 Answers  


Write a routine that prints out a 2-D array in spiral order

3 Answers   Microsoft,


Code for 1>"ascii to string" 2>"string to ascii"

1 Answers   Aricent, Global Logic,


main() { int x=5; clrscr(); for(;x<= 0;x--) { printf("x=%d ", x--); } } a. 5, 3, 1 b. 5, 2, 1, c. 5, 3, 1, -1, 3 d. –3, -1, 1, 3, 5

2 Answers   HCL,


Categories