30.12.20

c program to convert fahrenheit to celsius and celsius to fahrenheit

 CELSIUS TO FAHRENHEIT:

#include<stdio.h>

int main()

{

float cen,fah;

printf("Enter temperature in centigrade scale:");

scanf("%f",&cen);

fah=9/5.0*cen+32;

printf("Equivalent fahrenheit scale value is %f",fah);

return 0;

}

OUTPUT

Enter temperature in centigrade 27.5

Equivalent fahrenheit scale value is 81.5

FAHRENHEIT TO CELSIUS 

#include<stdio.h>

int main()

{

float cen,fah;

printf("Enter temperature in fahrenheit scale:");

scanf("%f",&fah);

cen=(fah-32)/1.8;

printf("Equivalent centigrade scale value is %f",cen);

return 0;

}

OUTPUT

Enter temperature in fahrenheit scale 32

Equivalent centigrade scale value is 0

No comments:

Post a Comment

JAVA program pattern 2

import java.util.Scanner; public class pattern3 { public static void main(String args[]) { int i,j; Scanner sc=new Scanner(System.in); Syste...