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); 


  •    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

Welcome.please sign up.


Welcome.please login.