Question

In: Computer Science

A customer has purchased 15 items in a department store.


A customer has purchased 15 items in a department store. Write a code segment to read the unit price and the quantity of each these 15 items and to compute and print its price (which is the unit price times the quantity). Also compute and print average price of the 15 items.

Solutions

Expert Solution

program in c language ;

#include
int main()
{
int sum=0,a=0,b=0,quantity=0;
int i;
float avg=0;
   for (i=1;i<=15;i++)
   {
   printf("enter price and quantity of item %d :\n",i);
   scanf("%d\n%d",&a,&b);
   sum += (a*b);
   quantity += b;
   }
   avg = sum/(float)15;
   printf("the total price is %d \n the average price is %.2f\n",sum,avg);
   return 0;
}


Related Solutions

Develop a python program that will determine if a department store customer has exceeded the credit...
Develop a python program that will determine if a department store customer has exceeded the credit limit on a charge account. For each customer, the following facts are available:  Account number  Balance at the beginning of the month  Total of all items charged by this customer this month  Total of all credits applied to this customer’s account this month  Allowed credit limit The program should input each of the facts, calculate the new balance (=beginning...
Develop a python program that will determine if a department store customer has exceeded the credit...
Develop a python program that will determine if a department store customer has exceeded the credit limit on a charge account. For each customer, the following facts are available:  Account number, Balance at the beginning of the month, Total of all items charged by this customer this month, Total of all credits applied to this customer’s account this month and Allowed credit limit. The program should input each of the facts, calculate the new balance (=beginning balance + charges – credits),...
The Customer Service Center in a large New York department store has determined that the amount...
The Customer Service Center in a large New York department store has determined that the amount of time spent with a customer about a complaint is normally distributed, with a mean of 9.9 minutes and a standard deviation of 2.4 minutes. What is the probability that for a randomly chosen customer with a complaint, the amount of time spent resolving the complaint will be as follows. (Round your answers to four decimal places.) (a) less than 10 minutes (b) longer...
The Customer Service Center in a large New York department store has determined that the amount...
The Customer Service Center in a large New York department store has determined that the amount of time spent with a customer about a complaint is normally distributed, with a mean of 9.9 minutes and a standard deviation of 2.7 minutes. What is the probability that for a randomly chosen customer with a complaint, the amount of time spent resolving the complaint will be as follows. (Round your answers to four decimal places.) (a) less than 10 minutes (b) longer...
The Customer Service Center in a large New York department store has determined that the amount...
The Customer Service Center in a large New York department store has determined that the amount of time spent with a customer about a complaint is normally distributed, with a mean of 9.1 minutes and a standard deviation of 2.4 minutes. What is the probability that for a randomly chosen customer with a complaint, the amount of time spent resolving the complaint will be as follows. (Round your answers to four decimal places.) (A) less than 10 minutes (B) longer...
The Customer Service Center in a large New York department store has determined that the amount...
The Customer Service Center in a large New York department store has determined that the amount of time spent with a customer about a complaint is normally distributed with a mean of 9.3 minutes and a standard deviation of 2.5 minutes. 1) What is the probability that for a randomly chosen customer with a complaint the amount of time spent resolving the complaint will be less than 12 minutes? Write your answer to four decimal places. 2)  What is the probability...
the customer service center in a large New York department store has determined that the amount...
the customer service center in a large New York department store has determined that the amount of time spent with the customer about a complaint is normally distributed with the mean of 9.3 minutes and a standard deviation of 2.2 minutes what is the probability that 4 randomly chosen customer with the complaint the amount of time spent with solving the complaint will be as follows a less than 10 minutes be longer than 5 minutes see between 8 and...
The Customer Service Center in a large New York department store has determined that the amount...
The Customer Service Center in a large New York department store has determined that the amount of time spent with a customer about a complaint is normally distributed, with a mean of 9.1 minutes and a standard deviation of 2.2 minutes. What is the probability that for a randomly chosen customer with a complaint, the amount of time spent resolving the complaint will be as follows. (Round your answers to four decimal places.) (a) less than 10 minutes (b) longer...
The Customer Service Center in a large New York department store has determined that the amount...
The Customer Service Center in a large New York department store has determined that the amount of time spent with a customer about a complaint is normally distributed, with a mean of 8.3 minutes and a standard deviation of 2.7 minutes. What is the probability that for a randomly chosen customer with a complaint, the amount of time spent resolving the complaint will be as follows. (Round your answers to four decimal places.) (a) less than 10 minutes (b) longer...
The Customer Service Center in a large New York department store has determined that the amount...
The Customer Service Center in a large New York department store has determined that the amount of time spent with a customer about a complaint is normally distributed, with a mean of 8.5 minutes and a standard deviation of 2.4 minutes. What is the probability that for a randomly chosen customer with a complaint, the amount of time spent resolving the complaint will be as follows. (Round your answers to four decimal places.) (a) less than 10 minutes (b) longer...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT