Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Program: assign03b.c Modify the assign03b.c to ask the user to enter a temperatu

ID: 3745872 • Letter: P

Question

Program: assign03b.c Modify the assign03b.c to ask the user to enter a temperature increase. The increased temperature cannot be out of range. Save a copy of your assign03a.c as assign03b.c and modify the file to include the changed requirements. Problem Constants: (with units) Same as above Problem Inputs: (with units) temperature temperature increase New commands: nested if else Problem Outputs: (with units) constant rate new constant rate Other variables: (with units) maximum temperature increase new temperature Equations: See above. Algorithnm **CONSTANTS **INPUT // get input variables as given in instructions // if temperature out of range print message only // instruct user to enter a temperature (10OK-500K) /1 if temperature out of range print message only // enter temperature increase, new temperature must be500K // if temperature too large print message only // COMPUTE // compute rate constant / **OUTPUT*** // display temperature and rate constant Run output: Sample test run I - too small Enter a temperature (100k-500k): 11 Temperature out of 100-500K range. Programming ending Sample test run 2 - too big Enter a temperature (100k-500k) 555 Temperature out of 100-500K range. Programming ending Sample test run 3 - within range and increase too large Enter a temperature (100k-500k): 300 Enter the increase in temperature Max temperature is 500K. Maximum increase is 200.0 Submit via Canvas: assign03a.c assignO3b.c Temperature increase is too large. Programming ending C program file Cprogram file Sample test run 4 - within range and increase within range Enter a temperature (100k-500k): 300 Enter the increase in temperature Max temperature is 500K. Maximum increase is 200.0. 100 Temperature (K)300 NOTE Your submitted filefs) MUST be spelled and cased as instructed. nstant: 1.78116e-003 Temperature (K)400 Rate Constant: 5.10297e-002 COMP1200C- Fall 2018-assign03-p. 3 of 3

Explanation / Answer

If you have any doubts, please give me comment...

1)

#include<stdio.h>

#include<math.h>

const double E = 2.71828;

const int A = 1200;

const int EA = 8000;

const double R = 1.9870;

int main(){

double temp;

printf("Enter a temperature (100k-500k): ");

scanf("%lf", &temp);

if(temp<100 || temp>500){

printf("Temperature out of 100-500K range. Programming ending. ");

return 0;

}

else{

double inc_temp;

printf("Enter the increase in temperature. ");

printf("Max temperature is 500K. Maximum increase is %.1lf. ", (500-temp));

scanf("%lf", &inc_temp);

if(inc_temp+temp>500){

printf("Temperature increase is too large. Programming ending. ");

return 0;

}

else{

double rate_constant = A*pow(E, EA/(R*temp));

printf("Temperature (K):%.1f ", temp);

printf("Rate Constant : %.2lf ", rate_constant);

rate_constant = A*pow(E, EA/(R*(temp+inc_temp)));

printf("Temperature (K): %.1lf ", (inc_temp+temp));

printf("Rate Constant : %.2f ", rate_constant);

}

}

return 0;

}

2)

#include<stdio.h>

#include<math.h>

const double E = 2.71828;

const int A = 1200;

const int EA = 8000;

const double R = 1.9870;

int main(){

double temp;

printf("Enter a temperature (100k-500k): ");

scanf("%lf", &temp);

if(temp<100 || temp>500){

printf("Temperature out of 100-500K range. Programming ending. ");

return 0;

}

else{

double rate_constant = A*pow(E, EA/(R*temp));

printf("Temperature (K):%.1f ", temp);

printf("Rate Constant : %.2lf ", rate_constant);

}

return 0;

}