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

Write a program that convert integer Fahrenheit temperature to Celsius or Celsiu

ID: 3739926 • Letter: W

Question

Write a program that convert integer Fahrenheit temperature to Celsius or Celsius to Fahrenheit. Use floating points with 3-digit precision. Your program should 1- Prompt to CF or FC. Where CF converting Celsius to Fahrenheit and FC to convert for converting from Fahrenheit to Celsius. Once you are ready to enter CF or FC, then 2- Enter FC and then enter 5 testing values all at once and hit enter to give the final answers value Repeat step a for CF a. in two colmuns- Column 1: Your entered values and Column 2: Your converted b. Commands (paste text not picture) Output (paste picture)

Explanation / Answer

Please find my C++ program

#include <stdio.h>
#include <string.h>

int main(){
   char choice[2];
   double temperature[5];
   int i;
   while(1){
       printf("Enter CF or FC: ");
       scanf("%s", choice);
       if(strcmp(choice, "CF") != 0 && strcmp(choice, "FC") != 0) break;
       printf("Enter 5 temperatures ");
       for(i = 0; i < 5; i++){
           scanf("%lf", &temperature[i]);
       }
       if(strcmp(choice, "CF") == 0){
           printf("Celsius Fahrenheit ");
       }
       else printf("Fahrenheit Celsius ");
       for(i = 0; i < 5; i++){
           printf("%.3lf ", temperature[i]);
           if(strcmp(choice, "CF") == 0){
               printf("%.3lf ", temperature[i] * 1.8 + 32);
           }
           else printf("%.3lf ", (temperature[i] - 32) / 1.8);
       }      
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote