In: Computer Science
C PROGRAM
Problem Specification:
You are a software engineer of a Car Sale company. And Car Sales is preparing for the end of the year sale. CEO wants to track the sales of your four sales people. You have been asked to help with the preparations for the sales event.
The CEO asked for a program to quickly tabulate their sale. It will be your job to implement this program in C. You are not required to use functions in this lab. Your program will need to perform the following tasks to receive full credit for this assignment:
Read a list of final sales of each sales person into a one-dimensional array.
Testing:
Try this set of sales, for your test run. $182,550.92 $239,557.34 $98,278.88 $ 411,642.47
Input:
Enter the sales for Sales Person 1: 182550.92
Enter the sales for Sales Person 2: 239557.34
Enter the sales for Sales Person 3: 98278.88
Enter the sales for Sales Person 4: 411642.47
Output:
Sales Person Percentage of Sale
Sales Person 1: 19.6%
Sales Person 2: 25.7%
Sales Person 3: 10.5%
Sales Person 4: 44.2%
Total Sales for Event: $932029.61
#include <stdio.h>
int main()
{
double sales[10];
int n;
printf("Enter number of sales people: ");
scanf("%d",&n);
double sum=0;
for(int i=0;i<n;i++){
printf("Enter the sales for Sales Person
%d:",i+1);
scanf("%lf",&sales[i]);
sum=sum+sales[i];
}
printf("Sales Person Percentage of Sale\n");
for(int i=0;i<n;i++){
printf("Sales Person %d: %.1lf
%\n",i+1,sales[i]/sum*100);
}
printf("Total Sales for Event: $%.2lf",sum);
return 0;
}
Note : Please comment below if you have concerns. I am here to help you
If you like my answer please rate and help me it is very Imp for me