C Saved Program: peaceful-home

facebook share

Here's the online compiler accompanied with IDE at your service. This is a saved code by one of our users. Try it out or save your own from the IDE page and don't forget to leave a feedback. You can find that at the bottom of the page.


#include<stdio.h>
int main()
{
int c, f, n;
printf("1= Celcius to Fahrenheit\n2= Fahrenheit to Celcius\n");
printf("Select the Converter:\n");
scanf("%d", &n);
if(n==1)
{
    printf("Enter the temperature in Celcius scale:\n");
    scanf("%d", &c);
    f=((9*c)/5)+32;
    printf("Temperature in Fahrenheit scale = %d", f);
}
else if(n==2)
{
    printf("Enter the temperature in Fahrenheit scale:\n");
    scanf("%d", &f);
    c=(5*(f-32))/9;
    printf("Temperature in Celcius scale = %d", c);
}
}
Execute

Output

Press the execute button or CTRL + enter to run code.

Inputs