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

Answers were Sorted based on User's Feedback



main() { int x=5; clrscr(); for(;x<= 0;x--) { printf("x=%d &quo..

Answer / guest

prints nothing, as condition in loop is false.

Is This Answer Correct ?    33 Yes 3 No

main() { int x=5; clrscr(); for(;x<= 0;x--) { printf("x=%d &quo..

Answer / purushotam111

Just change the operator in for >= instead of <=
then our answer is 5 , 3 , 1

Is This Answer Correct ?    16 Yes 2 No

Post New Answer

More C Code Interview Questions

main() { int k=1; printf("%d==1 is ""%s",k,k==1?"TRUE":"FALSE"); }

1 Answers  


main() { char name[10],s[12]; scanf(" \"%[^\"]\"",s); } How scanf will execute?

2 Answers  


main() { 41printf("%p",main); }8

1 Answers  


main() { static char names[5][20]={"pascal","ada","cobol","fortran","perl"}; int i; char *t; t=names[3]; names[3]=names[4]; names[4]=t; for (i=0;i<=4;i++) printf("%s",names[i]); }

2 Answers  


Write a C program to print ‘Campus Force training’ without using even a single semicolon in the program.

3 Answers   Wipro,






main ( ) { static char *s[ ] = {“black”, “white”, “yellow”, “violet”}; char **ptr[ ] = {s+3, s+2, s+1, s}, ***p; p = ptr; **++p; printf(“%s”,*--*++p + 3); }

1 Answers  


void main() { int *mptr, *cptr; mptr = (int*)malloc(sizeof(int)); printf(“%d”,*mptr); int *cptr = (int*)calloc(sizeof(int),1); printf(“%d”,*cptr); }

1 Answers  


main() { int i=5; printf("%d%d%d%d%d%d",i++,i--,++i,--i,i); }

7 Answers  


main() { struct date; struct student { char name[30]; struct date dob; }stud; struct date { int day,month,year; }; scanf("%s%d%d%d", stud.rollno, &student.dob.day, &student.dob.month, &student.dob.year); }

1 Answers  


how can i search an element in an array

2 Answers   CTS, Microsoft, ViPrak,


main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n", bit = (bit >> (i - (i -1)))); } } a. 512, 256, 128, 64, 32 b. 256, 128, 64, 32, 16 c. 128, 64, 32, 16, 8 d. 64, 32, 16, 8, 4

2 Answers   HCL,


void main() { int *i = 0x400; // i points to the address 400 *i = 0; // set the value of memory location pointed by i; }

2 Answers  


Categories