Computer Science, asked by dattaanwesha21, 9 months ago

49.What is the output of this C code?
#include <stdio.h>
main()
{
int n=0, m=0:
if (n>0)
if (m>0)
Printf ("True");
else,
Pointf ("false");
}
(a) True
(b) False
(c) No Output will be printed
(d) Run Time Error​

Answers

Answered by xcristianox
5

#include <stdio.h>

int main()

{

float f = 0.1;

if (f == 0.1)

printf("True");

else

printf("False");

return 0;

}

The output is false.

#include <stdio.h>

int main()

{

float f = 0.1;

if (f == (float)0.1)

printf("True");

else

printf("False");

return 0;

}

Now shows the correct output. Whats the reason behind this?

Also what is the reason of this behavior.

#include <stdio.h>

main()

{

int n = 0, m = 0;

if (n > 0)

if (m > 0)

printf("True");

else

printf("False");

}

Similar questions