Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C program for the following output a. Input number of product b. For eac

ID: 3837486 • Letter: W

Question

Write a C program for the following output a. Input number of product b. For each product input id, quantity, price c. Display id quantity and price of each product d. Add product price to the total c. If the product is more than one do step b, c, d for all the product f. Display the total price User loop for the program Enter number of product > 3 Enter 1 product id > 111 Enter I product quantity > 10 Enter 1 product price > 7.25 Product 1:111 10 7.25 Enter 2 product id > 222 Enter 2 product quantity > 15 Enter 2 product price > 9.75 Enter 3 product id > 333 Enter 2 product quantity > 8 Enter 2 product price > 10 Product 2: 111 8 10 Total price: 298.75

Explanation / Answer

#include<conio.h>
#include<stdio.h>
void main()
{
int p_id,p_quantity,no_product,i;
float p_price,total=0;

printf("Enter number of product ");
scanf("%d",&no_product);
printf(" ");
for(i=1;i<=no_product;i++)
{
printf("Enter %d product id ",i);
scanf("%d",&p_id);
printf(" ");
printf("Enter %d product quantity ",i);
scanf("%d",&p_quantity);
printf(" ");
printf("Enter %d product price ",i);
scanf("%f",&p_price);
printf(" ");
printf("Product %d : %d %d %f",i,p_id,p_quantity,p_price);
printf(" ");
total=total+p_quantity*p_price;
}
printf("Total Price : %f ",total);
getch();
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote