Write a program that converts the temperature variable doubl
Solution
1
main.c
/**
* C program to convert temperature from degree fahrenheit to celsius
*/
#include <stdio.h>
int main()
{
float celsius, fahrenheit;
// Reads temperature in fahrenheit
printf(\"Enter temperature in Fahrenheit: \");
scanf(\"%f\", &fahrenheit);
// Fahrenheit to celsius conversion formula
celsius = (fahrenheit - 32) / 1.8;
// Print the result
printf(\"\ %.2f Fahrenheit = %.2f Celsius\", fahrenheit, celsius);
return 0;
}
Output:-
2.
main2.c
/**
Correct program without error is given below with output
*/
#include<stdio.h>
int main()
{
int sum;
sum=25+37-19;
printf(\"the answer is %d\ \",sum);
return 0;
}
Output:-
3
main3.c
#include<stdio.h>
int main()
{
int answer, result;
answer=100;
result=answer-10;
printf(\"the result is %d\ \",result+5);
return 0;
}
Output:-

