View the step-by-step solution to:

I wrote this code #include< stdio.h > int main() { double number,squared; //prompts user for a number printf( "Enter a Number:

I wrote this code

#include<stdio.h>

intmain() 

{

doublenumber,squared;

//prompts user for a number

printf("Enter a Number:n");

scanf("%lf",&number); 

squared=number*number; 

//Calculates the square of the number

printf("The square of inputted number is: %lf",squared);

return0;

}

I got feedback after it was graded that I need to have a function call from main to a separate function that calculates the results and returns it to main. Could you please provide assistance.

how to make a function in C that accepts one input number and returns a double number. The themes for the functions should be one of the following:

  •  Calculates 3.14 times of the square of input number. For example, if 2 is input then 12.56 should be returned. (e.g. 3.14*2*2 = 12.56)
  •  Divides the number by 3 and returns the result. For example, if 6 was input then 2.0 should be returned.
  •  Squares the number and returns the result. For example, if 12.1 was entered then 146.41 would be returned.

Top Answer

The feedback needs around 3 functions. Each function handles the three lists. For each of the lists I... View the full answer

square.PNG

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online