Question

USE C Programming LANGUAGE ONLY PLEASE. We use <stdio.h> if that helps. For the following problems,...

USE C Programming LANGUAGE ONLY PLEASE. We use <stdio.h> if that helps. For the following problems, create the prototype function, calling function “int main()”, and function. So the function prototype, function call, and function header/body should be seen in the answer. The processor directive is not needed. Show a sample call from the int main() function for all problems. If you can for the first one please show proof that it has no errors.

1. Write a function called DisplayColumbiaUniversity with no arguments that displays:

*****************

Columbia University

*****************

2. Write a function called DisplayCollegeName that has college name as the argument. Show a sample call that will display Columbia University.

3. Write a function called DisplayArea that displays the area of a room when the width and length are passed as arguments.

4. Write a function called Area that calculates the area of a room and returns area when the width and length are passed as arguments.

5. Write a function called CalculatePerimeter that calculates the perimeter when the width and length are passed as arguments.

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

Answer: here is the answer for your question:

code:

----------------------------------------------------------------------------------------------------------------------------------------------------------------------


#include <stdio.h>
/*function prototyping is done here */
void DisplayColumbiaUniversity();
void DisplayCollegeName(char college_name[]);
void DisplayArea(int width,int length);
float Area(int width,int length);
float CalculatePerimeter(int width,int length);

int main()
{
char college_name[50];
int width,length,area_of_room;
/*function call is made here in main */
DisplayColumbiaUniversity();
printf("enter college name:");
fgets(college_name,sizeof(college_name),stdin);
DisplayCollegeName(college_name);
printf("enter width :");
scanf("%d",&width);
printf("enter length :");
scanf("%d",&length);
DisplayArea(width,length);
area_of_room=Area(width,length);
CalculatePerimeter(width,length);
}
/*function defination is done here */
void DisplayColumbiaUniversity()
{
char st[]="*****************";
  
char str[]="Columbia University";
  
  
printf("%s \n",st);
printf("%s \n",str);
printf("%s \n",st);
}
void DisplayCollegeName(char college_name[])
{
printf("%s",college_name);
}
void DisplayArea(int width,int length)
{
float area=width*length;
printf("DisplayArea function called and Area of room is %f \n",area);
}
float Area(int width,int length)
{
printf("Area function called and Area returned back to main \n");
float area=width*length;
return area;
}

float CalculatePerimeter(int width,int length)
{
float perimeter=2*length*width;
printf(" perimeter function called and perimeter of the room is %f",perimeter);
}

OUTPUT:

----------------------------------------------------------------------------------------------------------------------------------------------------------------------

I hope this would help you out

If you have any doubt, you can provide comment /feedback below the answer

Thanks


Add a comment
Know the answer?
Add Answer to:
USE C Programming LANGUAGE ONLY PLEASE. We use <stdio.h> if that helps. For the following problems,...
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
  • Please answer using C ++ programming language ONLY! We have only used <stdio.h> if that helps....

    Please answer using C ++ programming language ONLY! We have only used <stdio.h> if that helps. This is a basic course and the furthest we have gone is BASIC arrays. Write the code for the following problems using arrays. Write what would go in the “int main()” part of the program. For these problems, the entire program and program output is not needed. Just include what goes in the int main() part of the program. 1. Declare an integer array...

  • Write a matlab script(using only matlab) for this. Write a script to solve the following problem:...

    Write a matlab script(using only matlab) for this. Write a script to solve the following problem: Ask the user for the length and the width of a rectangle. These need to be passed to a function. The function is to calculate and return the area and the perimeter of the rectangle. The area is the length times the width and the perimeter is 2 times the length and 2 times the width. Make sure to suppress all output from the...

  • Please in C Language Thank you! The following program source code is incomplete 1 #include <stdio.h> 2 3 // TODO:...

    Please in C Language Thank you! The following program source code is incomplete 1 #include <stdio.h> 2 3 // TODO: 1) Add the typedef here: 5// TODO: 2) Modify the parameter of repeat to add irn the function pointer for the function to be called repeatedly: 8 void repeat (int times) for (int k 0; k < times; ++k) 12 // TODO: 3) Add the call to the function pointer here: 14 15 17 void test (void) 18 printf("Test!\n"); 19...

  • Programming in C (using only #include <stdio.h>) 1. Create and use a new function called average....

    Programming in C (using only #include <stdio.h>) 1. Create and use a new function called average. 2. Average will accept two integer arguments, (here I will name them sum and n). n is the count of values included in sum. 3. The function will return the integer average of sum. 4. Define and use a function that checks an integer to see if it is positive (returns true if the integer is positive) Note: Choosing proper definition attributes (names, arguments,...

  • Solve using C programming 3. lf you are given this code. #include <stdio.h> int main() int...

    Solve using C programming 3. lf you are given this code. #include <stdio.h> int main() int var1, var2; int sum; printf("Enter number 1:\n "); scanf("%d",&var1); printf("Enter number 2:In ); scanf("%d",&var2); sum-var1+var2; printf ("Vnsum of two entered numbers : %d", //printf ("Output: %d", res); sum); return e; Modify this code by creating a function called "addition". Make the arguments of the functions numberl and number 2. Add the two values in the function. Return a value called "result". Print "result" in...

  • write C code that uses pointers, arrays, and C strings. 3. Write a function called pow_xy....

    write C code that uses pointers, arrays, and C strings. 3. Write a function called pow_xy. The function should be passed 2 parameters, as illustrated in the prototype below. int pow_xy(int *xptr, int y); Assuming that xptr contains the address of variable x, pow_xy should compute x to the y power, and store the result as the new value of x. The function should also return the result. Do not use the built-in C function pow. For the remaining problems,...

  • Using basic c++ write a separate code for each of the following: 1. Area Rectangle •...

    Using basic c++ write a separate code for each of the following: 1. Area Rectangle • Write a program that asks the user to enter length and width of a rectangle and then display the rectangles area. • Write the following functions • getLength – prompt the user to enter length and return that value as a double • getWidth – prompt the user to enter width and return that value as a double • getArea – This method should...

  • 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;...

  • Using C programming

    Using C, create a data file with the first number being an integer. The value of that integer will be the number of further integers which follow it in the file. Write the code to read the first number into the integer variable how_many.Please help me with the file :((This comes from this question:Write the code to dynamically allocate ONE integer variable using calloc (contiguous allocation) or malloc (memory allocation) and have it pointed to by a pointer (of type int...

  • Programming language C Please go through this carefully. Needs function void add(int *a1, int n, int...

    Programming language C Please go through this carefully. Needs function void add(int *a1, int n, int *a2) Write a program addition.c that reads in an array (a1) of numbers, and creates a new array (a2) of numbers such that the first and last numbers of a1 are added and stored as the first number, the second and second-to-last numbers are added and stored as the second number, and so on. You need to check for even and odd length of...

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