There are two programs that you can write that are taken directly from the textb
ID: 3672573 • Letter: T
Question
There are two programs that you can write that are taken directly from the textbook for extra credit. The formula for converting centigrade temperature to Fahrenheit is: F = 32 + (C Times (180.0/100.0)) Write a program that asks the user to enter a temperature reading in centigrade and then prints the equivalent Fahrenheit value. Be sure to include at least one negative centigrade number in your test cases. Show the results of at least 3 test cases. Write a program that reads in three integers and then prints them in the order read and reversed. Use four functions:main, one to read in data, one to print them in the order read, and one to print them in reversed.Explanation / Answer
#include <stdio.h>
int main()
{
float celsius, fahrenheit;
printf(" Enter temp in centigrade(C): ");
int ioInt=scanf("%f", &celsius);
if(ioInt !=1){
printf(" Enter an integer value");
}
else
{
fahrenheit = (1.8 * celsius) + 32;
printf(" Temperature in Fahrenheit(F) : %f ", fahrenheit);
}
return (0);
}
Reverse integer:
#include <stdio.h>
int main()
{
int n, reverse = 0;
printf("Enter a number to reverse:");
int ioInt=scanf("%d", &n);
if(ioInt !=1){
printf(" Enter only integer value");
}
else
{
while (n != 0)
{
reverse = reverse * 10;
reverse = reverse + n%10;
n = n/10;
}
printf("Reverse of entered number is = %d ", reverse);
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.