EmbLogic's Blog

why value are not reading trough scanf

#include<stdio.h>
int main()
{
double a,b,c;

printf(“Enter the temprature in fahrenheit “);
scanf(“%e”,&a);
c=1.8*a+32;
b=1.8*a+32+273.16;
printf(“the conversion in fahrenheite %e celcius is %3.2e and is %6.2\n”,a,c,b);

return 0;
}

i  am reading the value through scanf and storing the value in double a as highlighted.

i am getting only garbage at output why.
Enter the temprature in fahrenheit 21  //what had happened to a ? why its is not storing the value.

the conversion in fahrenheite 1.978588e+65 celcius is 3.56e+65 and is 3.56e+65 

One Response to why value are not reading trough scanf

  1. rahul gaur says:

    #include
    #define CELCS(far) ((1.8*far)+32.0)

    int main()
    {
    double faar,kelvin;
    puts(“Enter the Room temp in Farenheit”);
    scanf(“%lf”,&faar);
    kelvin = CELCS(faar) + 273;
    printf(“The value Temprature in Kelvin is :%lf\n”,kelvin);
    return 0;
    }

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>