Question
using C language




Create an array of doubles with 5 elements. In the array prompt the user to enter 5 temperature values (in degree Fahrenheit)
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <stdio.h> 2 #include<math.h> 3 void convert2cel(double [],int x); 4 int main() double temp_array[5]; int i,n=5; prin

output:

Enter a fahrenherit values: 100 150 212 32 70 Temperatures (Celsius): 37.78 65.56 100.00 0.00 21.11 ...Program finished with

code:

#include <stdio.h>
#include<math.h>
void convert2cel(double [],int x);
int main()
{
double temp_array[5];
int i,n=5;
printf("Enter a fahrenherit values:\n");
for(i=0;i<n;i++)
{
scanf("%lf",&temp_array[i]); /*here we take fahrenherit tem from user */
}
  
convert2cel(&temp_array,n); /*here we call convert2cel function for Convert temp to celsius*/
  
printf("\nTemperatures(Celsius):\n");
for(i=0;i<n;i++) /*here we print celsius temp*/
{
printf("%.2lf \n",temp_array[i]);
}
return 0;
}

void convert2cel(double temp_array[],int n) /*in this function we convert fahrenherit to celsius*/
{
int i;
double cal=0,fahrenherit;
for(i=0;i<n;i++) /*here we do for 5 times to convert 5 temp into celsius*/
{
cal=5 * (temp_array[i]-32) / 9;
temp_array[i]=cal;
}

}

Add a comment
Know the answer?
Add Answer to:
using C language Create an array of doubles with 5 elements. In the array prompt the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program in C that will convert all 12 months' average temperature from Celsius to...

    Write a program in C that will convert all 12 months' average temperature from Celsius to Fahrenheit. You need to create an array named aye jump and prompt the user to input average temperature in Celsius for all 12 months. After that, you need to develop a user temperatures from Celsius to Fahrenheit and pass the array as reference and convert all temperatures from Celsius to Fahrenheit. Next, compute the average temperature of the year and assign it to a...

  • Can you help me to create this program, please? Prompt the user for the user for...

    Can you help me to create this program, please? Prompt the user for the user for a number of degrees in Fahrenheit as an int. That number should be passed to a function named ffocREFO. This function will do the necessary calculation to convert the passed temperature to degrees Celsius as a double. The function MUST have a void return type and have the following prototype: void ffccREF(double& celsius, int Faren); In your main, display both the entered temperature and...

  • In this project you will create a console C++ program that will have the user to...

    In this project you will create a console C++ program that will have the user to enter Celsius temperature readings for anywhere between 1 and 365 days and store them in a dynamically allocated array, then display a report showing both the Celsius and Fahrenheit temperatures for each day entered. This program will require the use of pointers and dynamic memory allocation. Getting and Storing User Input: For this you will ask the user how many days’ worth of temperature...

  • Create a program using MIPS that does the following: The program will do the following: Prompt...

    Create a program using MIPS that does the following: The program will do the following: Prompt the user to enter a letter indicating Celsius or Fahrenheit C or c indicates that temperature entered is in Celsius. F or f indicates that temperature entered is in Fahrenheit. If the letter entered is not C, c, F, or f, print out error message "Wrong Letter!". Prompt the user to enter an integer indicating the temperature matching the letter just entered. Convert the...

  • in matlab Fahrenheit and Celsius are related by equation: TeT 32)/1.8 Create a function called tempConv...

    in matlab Fahrenheit and Celsius are related by equation: TeT 32)/1.8 Create a function called tempConv that will convert temperature between Fahrenheit and Celsius The function should have two input parameters: one is a single temperature in degrees and the other one is the input temperature scale character 'C'or 'F The function should return the converted temperature as variable temp

  • Process Create a City structure. The structure will hold the name of a city and its temperature. ...

    using C Process Create a City structure. The structure will hold the name of a city and its temperature. In the main function, read in a series of city names and their temperature expressed in Fahrenheit. Store the data in an array of City structures. Stop reading when either: The user enters the word "quit" for a city name, or The size of the array is about to be exceeded. Create a function that determines the highest temperature of the...

  • C++ optional exercise. You are going to convert temperatures in this program. You will give the...

    C++ optional exercise. You are going to convert temperatures in this program. You will give the user the choice of converting Fahrenheit to Celsius or Celsius to Fahrenheit. With the correct answer you will also display the number entered. The user should have the option to convert as many temperatures as they want. Use functions and a menu (also a function) and, assume they will convert at least one temperature. When finished upload and submit the zipped project. the formulas...

  • R-Studio (R Programming Language) 9. The conversion from a temperature measurement in degrees Fahrenheit F to...

    R-Studio (R Programming Language) 9. The conversion from a temperature measurement in degrees Fahrenheit F to Celsius C is performed using the following equation `C = 5/ 9 (F - 32)` Use vector-oriented behavior in R to convert the temperatures `45, 77, 20, 19, 101, 120, and 212` in degrees Fahrenheit x_fahren` to degrees Celsius `x_cel`. ```{r} #insert your code ``` 10. Use the function `paste` to create the following character vectors of length 25: `("label 1", "label 2", .....,...

  • Create a function that takes two parameters : pointer to the array and the size of...

    Create a function that takes two parameters : pointer to the array and the size of the array. Print out the array's values and their memory addresses inside the function. Then create another function that takes two parameters : pointer to the array. Inside the function, multiply each of the array's values by two ad print the modified values out in the main function. With C programming language

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT