Share
Explore BrainMass

C Language Coding

Design and code an ANSI Standard C program which enhances the code at end of post to do the following:

First using a for loop (with two iterations):
a Ask for a Fahrenheit temperatures from the user .
b Get a Fahrenheit temperatures from the user and to store it in an fArray.
c Convert the temperatures to its Centigrade equivalent and store the temperatures in an Array.
d Display the Fahrenheit temperature from fArray and the Centigrade temperature from cArray.

Then using a while loop (with two iterations):
a Ask for a Fahrenheit temperatures from the user .
b Get a Fahrenheit temperatures from the user and to store it in an fArray.
c Convert the temperatures to its Centigrade equivalent and store the temperatures in an Array.
d Display the Fahrenheit temperature from fArray and the Centigrade temperature from cArray.
ALL the array manipulation (loading it, converting and displaying) must be done using a loop.
This array task points out the advantage of arrays if you imagine that you have two thousand temperatures not two. Imagine declaring, doing the conversion, possibly averaging, and displaying that many variables without using an array.
================
Code to enhance:

#include <stdio.h>

int main()
{

float fahrenheit;
float celsius;

printf("Enter the Fahrenheit temperature as a whole number: ");
scanf("%f",&fahrenheit);

celsius = 5.0/9.0*(fahrenheit - 32);

printf("Fahrenheit temperature %0.2fn",fahrenheit);
printf("Celsius temperature %0.2fn",celsius);
}

Solution Summary

This solution contains a ANSI Standard C program that enhances the code in the posting that can ask and store for Fahrenheit temperatures, covert temperatures to Centigrade equivalent and display temperatures in fArray and cArry.

$2.19