main()

{

int x=5;

for(;x!=0;x--) {

printf("x=%d\n", x--);

}

}

a. 5, 4, 3, 2,1

b. 4, 3, 2, 1, 0

c. 5, 3, 1

d. none of the above

Answers were Sorted based on User's Feedback



main() { int x=5; for(;x!=0;x--) { printf("x=%d\n", x--); } } ..

Answer / guest

d) Infinite loop as x is decremented twice, it never be 0

and loop is going on & on

Is This Answer Correct ?    13 Yes 0 No

main() { int x=5; for(;x!=0;x--) { printf("x=%d\n", x--); } } ..

Answer / ajit

first error in 4 step as syntax error
this is so that for(x!=0;x--) answer is d becoze here
not defined x=?

Is This Answer Correct ?    0 Yes 10 No

Post New Answer

More C Code Interview Questions

Is the following code legal? typedef struct a { int x; aType *b; }aType

1 Answers  


main() { static int a[3][3]={1,2,3,4,5,6,7,8,9}; int i,j; static *p[]={a,a+1,a+2}; for(i=0;i<3;i++) { for(j=0;j<3;j++) printf("%d\t%d\t%d\t%d\n",*(*(p+i)+j), *(*(j+p)+i),*(*(i+p)+j),*(*(p+j)+i)); } }

1 Answers  


#include <stdio.h> #define a 10 main() { #define a 50 printf("%d",a); }

2 Answers  


how can i search an element in an array

2 Answers   CTS, Microsoft, ViPrak,


void main() { int c; c=printf("Hello world"); printf("\n%d",c); }

2 Answers  






Sorting entire link list using selection sort and insertion sort and calculating their time complexity

1 Answers   Infosys, Microsoft, NetApp,


Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary.

1 Answers  


how to delete an element in an array

2 Answers   IBM,


write a function to give demostrate the functionality of 3d in 1d. function prototye: change(int value,int indexX,int indexY,int indexZ, int [] 1dArray); value=what is the date; indexX=x-asix indexY=y-axis indexZ=z-axis and 1dArray=in which and where the value is stored??

0 Answers   Nagarro,


main() { int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf(" %d ",*c); ++q; } for(j=0;j<5;j++){ printf(" %d ",*p); ++p; } }

1 Answers  


To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']

0 Answers  


main() { char c; int i = 456; clrscr(); c = i; printf("%d", c); } a. 456 b. -456 c. random number d. none of the above

3 Answers   BrickRed, HCL,


Categories