Question: Write a C program to perform the following tasks. a) Let the user to choose whether to find the area of a circle ( call

Write a C program to perform the following tasks.

a) Let the user to choose whether to find the area of a circle ( call AreaOfCircle of Question 1), or the average of eight scores ( call AveOf8Scores of Question 2 ), or the weekly pay for an employee ( call WeeklyPay of Question 3 ).

b) Allow the user to repeat as often as desired. My code so far is below.

#include "stdio.h"

#define PI 3.14

int aoc(int r){ int area; area=PI*r*r; return area; }

double WeeklyPay(int n) { // if no of hours is less than 35 if( n <= 35 ) return (double)n * 8.25; // if no of hours is more than 35 else return 35.0 * 8.25 + ( (double)n - 35.0 ) * 12.5; } double AveOf8Scores() { int scores[8]; double sum = 0, avg;

for(int i = 0; i< 8; i++) { printf("Enter %d score: ", i+1); scanf("%d", &scores[i]); sum = sum + scores[i]; } avg = sum/8;

return avg; } int main(void) { float r,circle; printf("Enter The Radius"); scanf("%f",&r); circle = aoc(r); printf("Answer=%f",circle); int n; printf("Enter the number of hours : "); scanf("%d", &n); printf(" Weekly Pay : %lf", WeeklyPay(n)); double avg;

avg = AveOf8Scores();

return 0; }

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!