Thursday, September 17, 2009

log

1.Which statement will you add in the following program to work it correctly?
#include
int main()
{
printf("%f\n", log(36.0));
return 0;
}

answer:#include"math.h"

2.We want to round off x, a float, to an int value, The correct way to do is
A.

y = (int)(x + 0.5)

B.

y = int(x + 0.5)
C.

y = (int)x + 0.5
D.

y = (int)((int)x + 0.5)



3.

Which of the following statement obtains the remainder on dividing 5.5 by 1.3 ?
A.

rem = (5.5 % 1.3)
B.

rem = modf(5.5, 1.3)
C.

rem = fmod(5.5, 1.3)

D.

Error: we can't divide

No comments:

Post a Comment