i=20,k=0;
for(j=1;j<i;j=1+4*(i/j))
{
k+=j<10?4:3;
}

printf("%d", k);

Answers were Sorted based on User's Feedback



i=20,k=0; for(j=1;j<i;j=1+4*(i/j)) { k+=j<10?4:3; } printf("%d", k); ..

Answer / guest

k=4

Is This Answer Correct ?    20 Yes 3 No

i=20,k=0; for(j=1;j<i;j=1+4*(i/j)) { k+=j<10?4:3; } printf("%d", k); ..

Answer / valli

k=4

Is This Answer Correct ?    9 Yes 4 No

i=20,k=0; for(j=1;j<i;j=1+4*(i/j)) { k+=j<10?4:3; } printf("%d", k); ..

Answer / vishal bhardwaj

ans is : 4

Is This Answer Correct ?    2 Yes 0 No

i=20,k=0; for(j=1;j<i;j=1+4*(i/j)) { k+=j<10?4:3; } printf("%d", k); ..

Answer / abi

all the above answers are wrong!
just think the below logic...

in for loop j=1+4*20 so j=81

81<10 is false...so 3 is assigned
k+=3 ie k=k+3
k=0+3
k=3


so answer is 3

Is This Answer Correct ?    15 Yes 15 No

i=20,k=0; for(j=1;j<i;j=1+4*(i/j)) { k+=j<10?4:3; } printf("%d", k); ..

Answer / arun

4

Is This Answer Correct ?    2 Yes 3 No

i=20,k=0; for(j=1;j<i;j=1+4*(i/j)) { k+=j<10?4:3; } printf("%d", k); ..

Answer / guest

compilation error i is not declared as int

Is This Answer Correct ?    5 Yes 7 No

i=20,k=0; for(j=1;j<i;j=1+4*(i/j)) { k+=j<10?4:3; } printf("%d", k); ..

Answer / vignesh1988i

k=4;;;;;

Is This Answer Correct ?    1 Yes 6 No

i=20,k=0; for(j=1;j<i;j=1+4*(i/j)) { k+=j<10?4:3; } printf("%d", k); ..

Answer / suchita

k=5 bcoz the statement k+=j<10?4:3;
here k+ increaments the value then assign to the k

Is This Answer Correct ?    1 Yes 11 No

Post New Answer

More C Interview Questions

who is first prime minister in india??

8 Answers   Wipro,


Is it better to bitshift a value than to multiply by 2?

0 Answers  


What is malloc() function?

0 Answers  


1) int main() { unsigned char a = 0; do { printf("%d=%c\n",a,a); a++; }while(a!=0); return 0; } can anyone please explain the explain the output

2 Answers  


How can you draw circles in C?

0 Answers   Accenture,






wat are the two methods for swapping two numbers without using temp variable??

2 Answers  


What are local static variables?

0 Answers  


What is the difference between char a[] = "string"; and char *p = "string"; ?

14 Answers   Adobe, Honeywell, TCS,


An expression to whose value an operater is applied a) operand b) variable c) constant d) all of the above

0 Answers  


What is an expression?

0 Answers  


why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???

0 Answers  


What is c basic?

0 Answers  


Categories