Answer to Question #209736 in C for Prasanna

Question #209736

Design a structure for the Invoice Detail and find total cost of purchase for a product.The structure includes members as Productname ,Quantity,Price.


Runtime Input :


Product name : Juice

Quantity : 2

Price : 15


Output :


Product name : Juice

Quantity : 2

Price : 15

Total cost : 30


1
Expert's answer
2021-06-23T02:57:37-0400
#include <stdio.h>


struct InvoiceDetail{
	char Productname[20];
	int Quantity;
	int Price;
};




int main(void){
	struct InvoiceDetail invoiceDetail;
	gets(invoiceDetail.Productname);
	scanf("%d",&invoiceDetail.Quantity);
	scanf("%d",&invoiceDetail.Price);
	printf("\n%s\n",invoiceDetail.Productname);
	printf("%d\n",invoiceDetail.Quantity);
	printf("%d\n",invoiceDetail.Price);
	printf("%d\n",(invoiceDetail.Quantity*invoiceDetail.Price));
	
	
	return(0);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS