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

Predict the output or error(s) for the following: 25. main() { printf("%p",main); }

3 Answers   Google, ME,


What is difference between constant pointer and constant variable?

0 Answers   Hexaware,


How to develop software using "c" programming?

1 Answers   IBM, TCS,


how is the examination pattern?

0 Answers   Wipro,


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

1 Answers  






What are the 5 types of inheritance in c ++?

0 Answers  


Why pointers are used in c?

0 Answers  


write a c program to check weather a particluar bit is set or not?

5 Answers   IBM,


Explain the difference between call by value and call by reference in c language?

0 Answers  


1. Write a program to reverse every second word in a given sentence.

1 Answers  


What is volatile keyword in c?

0 Answers  


write a C program: To search a file any word which starts with ?a?. If the word following this ?a? starts with a vowel.Then replace this ?a? with ?a? with ?an?. redirect with the output onto an output file.The source file and destination file are specified by the user int the command line.

0 Answers   Subex,


Categories