Answer to Question #209397 in C for Prasanna

Question #209397

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


Input :

Juice

2

15


Output :

Juice

2

15

30


1
Expert's answer
2021-06-22T14:52:29-0400
#include <stdio.h>




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




int main(void)
{
	struct Invoice invoice;
	int total;
	gets(invoice.Productname);
	scanf("%d",&invoice.Quantity);
	scanf("%d",&invoice.Price);
	total =invoice.Quantity*invoice.Price;
	printf("%s\n",invoice.Productname);
	printf("%d\n",invoice.Quantity);
	printf("%d\n",invoice.Price);
	printf("%d\n",total);
	


	getchar();
	getchar();
	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