ProAnswers.org

C program to convert Celsius to Fahrenheit

1 Like

#include

#include

void main

{

float cel,fah;

clrscr();

printf("Enter the Degrees in Celsius
",cel);

scanf("%f",&cel);

fah=(c*1.8)+32;

printf("Fahrenheit is %f
",fah);

getch();

}

OUTPUT:

              Enter the degreees in Celsius

              21

              Fahrenheit is 69.800003
#include

main()

{

float c,f;

printf("

Enter the temperature in celsius:" );

scanf("%f",&c);

f = (9*c/5)+32;

printf("

The temperature in fahrenheit is %f:",f);

}

Is the formula f=(9c/5)+32;
or f=(c
1.8)+32;
???/

the main logic of this program is c/5=(f-32)/9 and this logic is 100% correct

[b]#include[/b]

[b]int main()[/b]

[b]{[/b]

[b]    float c;[/b]

[b]    printf("

Enter the Celsius to Fahrenheit : ");[/b]

[b]    scanf("%f",&c);[/b]

[b]    printf("

Fahrenheit : %f ",((float)9/5*c)+32);[/b]

[b]    system("pause");[/b]

[b]}[/b]