Question: Please solve these in C: 1. Write two functions, one that displays a triangle and on that displays a rectangle. The goal is to create

Please solve these in C:

1. Write two functions, one that displays a triangle and on that displays a rectangle. The goal is to create a main that calls the two functions. Each of these functions has no return value or pass by value parameter (output parameter). Use these functions to write a complete C program from the following outline: //preprocessors //prototypes int main(void) { /* draw triangle. */ /* draw rectangle. */ /* display two blank lines. */ /* draw triangle. */ /* draw rectangle */ } //function definitions

2. Write a program that takes a positive number with a fractional part and rounds it to two decimal places. The main program should call a function that returns the result of double and takes a double parameter. Hint: use math and data types, if you take a double and assign it to an integer the decimal part is chopped off. Use multiplication, division, and data types to complete this problem. In addition, 3 functions should be utilized including: printing instructions, calculating result and printing result. Pseudocode for # 2 //preprocessors //comments //prototypes all three functions //print instructions function no parameters, no return value //rounding function double parameter of value that was input in main, double return value of the rounded number //print results function double parameter of the number to print, no return value Int main() { //declare variables //call the function to print the instructions no return value or parameter //input data (number to be rounded) in the main //print //scan //call the function to round it with the number inputted as the double parameter and the return value the rounded number //call a function to print the results, the function will have no return value, just a double parameter to print out. }//close the main //write all three functions

3. Four track stars have entered the mile race at the Penn Relays. Write a program that scans in the race time in minutes and seconds for a runner and computes and displays the speed in feet per second and meters per second. Hints: There are 5280 feet in one mile, and one kilometer equals 3,282 feet. #3 Pseudocode //preprocessors //comments //prototypes all four functions //print instructions function no parameters, no return value //calculate feet per second function two pass by value parameters, minutes and seconds, return value is feet per second //calculate meters per second function - two pass by value parameters, minutes and seconds, return value is meters per second //print results function 2 double parameters including feet per second, and meters per second, no return value Int main() { //declare variables //call the function to print the instructions no return value or parameter //input data in the main //print //scan //call the function to calculate feet per second //call a function to calculate meters per second //call the function to print the results } //close the main //write all four functions

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!