C Programming - Floating Point Issues - Discussion

Discussion Forum : Floating Point Issues - Find Output of Program (Q.No. 4)
4.
What will be the output of the program?
#include<stdio.h>
#include<math.h>
int main()
{
    printf("%f\n", sqrt(36.0));
    return 0;
}
6.0
6
6.000000
Error: Prototype sqrt() not found.
Answer: Option
Explanation:

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.

Discussion:
15 comments Page 2 of 2.

Nishant said:   1 decade ago
But when I tried in turbo C it return 0. Why?

Meghana said:   1 decade ago
Can anyone explain me how 36.0 is double?

Raj said:   1 decade ago
How 36 is double, please explain?

Surbhi Rajput said:   6 years ago
How it can be double?

Surbhi said:   1 decade ago
Why not 6.0?


Post your comments here:

Your comments will be displayed after verification.