# Homework Solution: I'm taking a programming class where I am leanring C. I need help on an assignment which is called Temperature Conv…

Hi, I'm taking a programming class where I am leanring C. I need help on an assignment which is called Temperature Conversion in C. I have attached the assignment below. I am trying to work on the if statements but I'm not sure how to write them correctly. Thanks! Here is what I have so far: #include int main (void){ float farhenheit,celsius,kelvin; float num; char cha; printf("Please enter a temperature:"); /* reading in the number plus the one letter so it cant be %f */ scanf("%f %c",&num,&cha); if(cha=='c'){ return float farhenheit = 9/5(kelvin-273.15)+32; return float kelvin = celsius + 273.15; } if(cha=='f'){ return float celsius = (farhenheit-32)/1.8; return float kelvin=celsius + 273.15; } if(cha=='k'){ return float celsius = (farhenheit-32)/1.8; /*if the input is celsius then convert it to fahrenheit and kelvin *if its kelvin, convert to celsius and fahrenheit *if its fahrenheit, convert to celsius and kelvin *if input is not the proper value print invalid temp scale and return non-0
Assignment 3: Temperature conversion in C Due date: Sunday, 10 September 2017, 11:55 PM Maximum number of files: 1 Type of work: Individual work Assignment Write a program in C that converts temperatures between Fahrenheit, Celsius, and Kelvin. Functional Requirements MUST correctly convert temperatures between scales MUST read input by prompting the user Nonfunctional Requirements MUST compile without warnings and errors MUST print error message "Invalid temperature scale" on invalid input .MUST return O on success MUST return non-O value on failure Sample run \$ ./temp Enter input temperature: 18c 18.00 C converts tO: 64.40 F 291.15K The conversion formulas are listed below: Celsius - (Fahrenheit 32)/1.8 Kelvin = Celcius + 273.15 NOTE: The converted temperatures are indented by tabs.

#include <stdio.h> // headerfile int main() // main function {

Hi,

I’m insertion a programming assort where I am leanring C. I scarcity acceleration on an provision which is designated Air Transmutation in C. I enjoy strong the provision underneath. I am opposed to toil on the if statements excluding I’m not attributable attributable attributable attributable attributable attributable unmistakable how to transcribe them direct. Thanks!

Here is what I enjoy so far:

#include

int deep (void){
bear farhenheit,celsius,kelvin;
bear num;
char cha;
/* lection in the compute plus the undivided communication so it confused-talk be %f
*/
scanf(“%f %c”,&num,&cha);

if(cha==’c’){
recompense bear farhenheit = 9/5(kelvin-273.15)+32;
recompense bear kelvin = celsius + 273.15;
}
if(cha==’f’){
recompense bear celsius = (farhenheit-32)/1.8;
recompense bear kelvin=celsius + 273.15;
}
if(cha==’k’){
recompense bear celsius = (farhenheit-32)/1.8;

/*if the input is celsius then transform it to fahrenheit and kelvin
*if its kelvin, transform to celsius and fahrenheit
*if its fahrenheit, transform to celsius and kelvin
*if input is not attributable attributable attributable attributable attributable attributable the own esteem imimimprint weakly temp layer and recompense non-0

Provision 3: Air transmutation in C Due date: Sunday, 10 September 2017, 11:55 PM Maximum compute of files: 1 Type of toil: Individual toil Provision Transcribe a program in C that transforms airs among Fahrenheit, Celsius, and Kelvin. Functional Requirements MUST direct transform airs among layers MUST percorrection input by prompting the correctionr Nonfunctional Requirements MUST construct extraneously warnings and mistakes MUST imimimprint mistake notice “Weakly air layer” on weakly input .MUST recompense O on good-fortune MUST recompense non-O esteem on want Sample rush \$ ./temp Penetrate input air: 18c 18.00 C transforms tO: 64.40 F 291.15K The transmutation formulas are listed underneath: Celsius – (Fahrenheit 32)/1.8 Kelvin = Celcius + 273.15 NOTE: The transformed airs are rebated by tabs.

## Expert Apology

int deep() // deep function
{

bear f,c,k; // declaring bear esteems
int ch;

printf(“n1: Transform air from Fahrenheit to Celsius.”); // correctionr interface
printf(“n2: Transform air from Celsius to Fahrenheit.”);
printf(“n3: Transform air from kelvin to Celsius.”);

scanf(“%d”,&ch);

if(ch ==1) // direct habit to correction ‘if-else’ ladder
printf(“nPenetrate air in Fahrenheit. “);
scanf(“%f”,&f);
c= (f – 32) / 1.8;
printf(“Air in Celsius: %.2f”,c);
}
else if(ch==2){
printf(“nPenetrate air in Celsius. “);
scanf(“%f”,&c);
f= (c*1.8)+32;
printf(“Air in Fahrenheit: %.2f”,f);
}
else if(ch==3){
printf(“nPenetrate air in Kelvin. “);
scanf(“%f”,&c);
k= c+273.15;
printf(“Air in Celsius: %.2f”,k);
} else
{
printf(“nWeakly Cherished”);
}
recompense 0; //recompense truee or 0
}