Write a program that converts the temperature variable (double a = 73.5) from Fa
ID: 3783100 • Letter: W
Question
Write a program that converts the temperature variable (double a = 73.5) from Fahrenheit (F) to Celsius (C) using the below formula. Show the two values before and after conversion on the screen. C = (F - 32)/1.8 Identify the syntactic errors in the following program. Then type in and run the corrected program to ensure you have correctly identified all the mistakes. #include int main (Void) (INT sum;/* COMPUTE RESULT sum =25 + 37 - 19/* DISPLAY RESULTS//printf ("The answer is %i " sum); return 0;} What output might you expect from the following program? #include int main (void) {int answer, result; answer = 100; result = answer - 10; printf ("The result is %i ", result +5); return 0;}Explanation / Answer
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:-
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.