logo codesdope

why is it showing wrong output?

   neha samala

#include <stdio.h>
float result;   /* Result of the divide */
int main()

{    result = 7.0 / 22.0;
    printf("The result is %d\n", result);   

return (0); 
}


Answers

  •    Aakhya Singh

    This is because the variable result is of type float and you are using %d to print its value. Use %f instead.


    • even though it is %d it should only print integer value..but it is printing address why?
      - neha samala

Download Our App.
BlogsDope App
Get it on Google Play
Write your answer
Close

Welcome.please sign up.

Close

Welcome.please login.