I got feedback after it was graded that i need to have a


I wrote this code

#include

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.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: I got feedback after it was graded that i need to have a
Reference No:- TGS02878436

Now Priced at $15 (50% Discount)

Recommended (94%)

Rated (4.6/5)