Question

In C code Directions: Write fully executable code when answering the following: 1. Write a function...

In C code

Directions: Write fully executable code when answering the following:

1. Write a function prototype for a function called GetInput that takes no arguments. The function will ask, get, and then return a double value input from the user.

2. Write the function definition for GetInput

3. Write the function call to GetInput using the variable points that has already been declared

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code:

#include<stdio.h>
// Declaring function prototype.
double GetInput();
int main()
{
   // Calling the function from the main function.
   double hold=GetInput();
   printf("The value returned by the function: %lf ",hold);
   return 0;
}
// This is the function definition or implementation.
double GetInput()
{
   double d;
   printf("Enter a double value:");
   //Getting in put from the user. Here %lf is format specifier used to specify double datatype.
   scanf("%lf",&d);
   return d;
}

Output:

Add a comment
Know the answer?
Add Answer to:
In C code Directions: Write fully executable code when answering the following: 1. Write a function...
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
  • You are to write a program IN C++ that asks the user to enter an item's...

    You are to write a program IN C++ that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: if the an item's wholesale cost is 5.00 and its markup percentage is 100%, then the item's retail price is 10.00 If an item's wholesale cost is 5.00 and its markup percentage is 50%, then the item's retail price is 7.50 Program design specs. You should have 5...

  • 1. Write a statement that calls a function named showSquare, passing the value 10 as an...

    1. Write a statement that calls a function named showSquare, passing the value 10 as an argument. 2. Write the function prototype for a function called showSquare. The function should have a single parameter variable of the int data type and areturn type of void. 3. Write the function prototype for a function called showScoreswith a parameter list containing four integer variables and a return type of void. 4. Look at the following function definition: double getGrossPay(int hoursWorked, double payRate)...

  • Need help problem 9-13 C++ Homework please help WRITE FUNCTION PROTOTYPES for the following functions. The...

    Need help problem 9-13 C++ Homework please help WRITE FUNCTION PROTOTYPES for the following functions. The functions are described below on page 2. (Just write the prototypes) When necessary, use the variables declared below in maino. mm 1.) showMenu m2.) getChoice 3.) calcResult m.) showResult 5.) getInfo mm.) showName 7.) calcSquare 8.) ispositive int main { USE THESE VARIABLES, when needed, to write function prototypes (#1 - #8) double num1 = 1.5; double num2 = 2.5; char choice; double result;...

  • answer in c++ Using the table below, complete the C++ code to write the function prototype...

    answer in c++ Using the table below, complete the C++ code to write the function prototype statement, and the void function header. The void function should receive three double variables: the first two by value and the last one by reference. Name the formal parameters num1, num2 and answer. The function should divide the num1 variable by the num2 variable and then store the result in the answer variable. Name the function calcQuotient. Also write an appropriate function prototype for...

  • In C code 1. Write and submit the algorithm OR flowchart to indicate you understand the...

    In C code 1. Write and submit the algorithm OR flowchart to indicate you understand the problem 2. Create a project and name the source code lastname_firstname_prog5.c 3. Use the prog5.c as a guide, copy/ paste into your project source code *** build run and test, the outline code - You will need to declare an integer variable called again and initialize it 4. Add the function prototype and implement the function definition for the Greeting function 5. Add the...

  • 1. Write code for a function that receives two parameters (a,and b) by value and two...

    1. Write code for a function that receives two parameters (a,and b) by value and two more parameters (c and d) by reference. All parameters are double. The function works by assigning c to (a/b) and assigning d to (a*b). The function has no return value. From main, use scanf to get two numbers, then call the function, and then display both outcome values to the output in a printf statement. 2. After part 1 is completed, write code to...

  • In C An array ints of integers has already been declared and initialized. A function printint...

    In C An array ints of integers has already been declared and initialized. A function printint has been defined with the following prototype: void printint(int *); Write code that will call printint with a pointer to the second value in the array ints. Note: you will not need to declare an int variable.

  • Please help code in c++ and use the answers you get from question 1 and 2...

    Please help code in c++ and use the answers you get from question 1 and 2 into the 3rd answer! Question 1 is first, question 2 is in the middle, question 3 is last Input Array (10 pts) te a function only (no main) that takes an array of doubles as a parameter as well as another integer rray. Create a for loop that asks the user to input any real number between-100 and r each element of the array....

  • Please Use Python and provide explanations!!!! 1. Write a function called multiply_and_print that takes two numbers,...

    Please Use Python and provide explanations!!!! 1. Write a function called multiply_and_print that takes two numbers, multiplies them together, and prints out the sentence '____ times ____ is ____'. Ask the user for two numbers, and call multiply_and_print with their two numbers as arguments. 2.Write a function called roll_dice that rolls two six-sided dice and prints out the result of each die. Call it three times. (Remember, you can import the random module with the statement import random, and then...

  • A(n) is a piece of data that is sent to a function when the function is...

    A(n) is a piece of data that is sent to a function when the function is called. argument parameter packet code All of these are true A variable is declared outside all functions. local global floating-point counter None of these Look at the following function prototype, int myFunecion(double); What is the data type of the function's return value? inc double void Can't tell from the prototype Look at the following function prototype. int myFunction(double, double, double); How many parameter variables...

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