Write a C C++ program to convert from Celsius to Fahrenheit

 

Flowchart

Centigrade to Fahrenheit conversion flowchart

 

Coding in C

#include<stdio.h>
int main()
{
float c,f;
printf(“Enter temperature in celsius: “);
scanf(“%f”,&c);
f = 32+(c*9)/5;
printf(“Temperature in fahrenheit = %f”,f);
return 0;
}

 

Coding in C++

#include<iostream>
using namespace std;
int main()
{
float c,f;
cout<<“Enter temperature in celsius: “;
cin>>c;
f = 32+(c*9)/5;
cout<<“Temperature in fahrenheit = “<<f;
return 0;
}

 

Output

Centigrade to Fahrenheit conversion output

 

Published by

admin

I am a computer teacher, programmer and web developer