Step 1:
Open the IDE and File->New.
Step2:
Type the coding given here.
CODING:
#include<stdio.h>
main()
{
float cg, fr;
printf("\n CONVERTING CENTIGRADE TO FAHRENHEIT VALUE");
printf("\n\nEnter the centigrade value");
scanf("%f", &cg);
fr=(9.0/5.0*cg+32.0);
printf("\n\nThe centigrade value is %5.2f",cg );
printf("\n\nThe fahrenheit value is %5.2f", fr);
getch();
}
main()
{
float cg, fr;
printf("\n CONVERTING CENTIGRADE TO FAHRENHEIT VALUE");
printf("\n\nEnter the centigrade value");
scanf("%f", &cg);
fr=(9.0/5.0*cg+32.0);
printf("\n\nThe centigrade value is %5.2f",cg );
printf("\n\nThe fahrenheit value is %5.2f", fr);
getch();
}
OUTPUT:
First declaring the variables. The formula is F = (9/5)*C + 32. stdio.h is used so that we use scanf and printf.
No comments:
Post a Comment