Description
Question 1
Show the value of x after each of the following statements is performed:
- x = floor(7.5) ii. x = ceil (0.0) iii. x = ceil (-6.4) iv. x = log10(100.0)
- x = ceil (floor (-5.5))
Question 2
Write a function called circleArea() that take the radius of a circle as an argument and calculate and return the area. In the main program read the radius value from the user, call circleArea() and display the result.
Question 3
Write three functions do the following add – add two integers pass as parameters and return the result multiply – multiply two integers pass as parameters and return the result square – receive an integer as a parameter and return the result after multiplying the number by itself.
Use these functions in the main program to calculate the result of the following mathematical expression. (3*4 + 5*7) 2
Additional Exercises
Question 1
- i) Write a function that displays a solid square of asterisks whose side is specified in integer parameter side. For example, if side is 4, the function displays
****
****
****
****
- ii) Modify the function created in i) above to form the square out of the character contained in character parameter fillCharacter. Thus if side is 3 and fillCharacter
is “#”, then this function should print
### ### ###
Question 2
The roots of a function can be calculated as given below.
Write a C program to input any three values for a, b, c and to calculate the roots.
Hint : Use pow and sqrt function in math library.
Question 3
You are asked to write a C program to calculate the final mark and grade of 5 students for a subject.
- Write a function called calcFinalMark() to calculate the final mark of the subject. When calculating the final mark, 30% is taken from the assignment mark and 70% is taken from the paper mark. Function should return the final mark. Assignment mark and paper mark are given as parameters to the functions.
float calcFinalMark(float assignmentMark, float paperMark);





