Floating Point Issues

Q1:
What will be the output of the program?
#include<stdio.h>
#include<math.h>
int main()
{
    printf("%f\n", sqrt(36.0));
    return 0;
}

A 6.0

B 6

C 6.000000

D Error: Prototype sqrt() not found.

ANS:C - 6.000000

printf("%f\n", sqrt(36.0)); It prints the square root of 36 in the float format(i.e 6.000000). Declaration Syntax: double sqrt(double x) calculates and return the positive square root of the given number.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.