120./*Write a program to print the item,qty,price and
multiplication of qty & price and find out his total value*/
#include<stdio.h>
#include<conio.h>
struct inv
{
int item;
int qty;
int price;
};
void main()
{
int i,count;
struct inv item[10];
clrscr();
printf("\nEnter Number of
Itema:");
scanf("%d",&count);
printf("\n");
for(i=0;i<count;i++)
{
printf("ITEM:QTY:PRICE:");
scanf("%d%d%d",&item[i].item,&item[i].qty,&item[i].price);
}
value(item,count);
getch();
}
value(cal,num)
struct inv cal[10];
int num;
{
int i;
int value;
printf("\n\n********S T O C K
V A L U E**********\n");
printf("\nITEM\tQTY\tPRICE\t\tQTY
*PRICE");
for(i=0;i<num;i++)
{
value=cal[i].qty*cal[i].price;
printf("\n%d\t%d\t%d\t\t%d",cal[i].item,cal[i].qty,cal[i].price,value);
}
return(0);
}
OUTPUT
Enter
Number of Item : 1
ITEM:QTY:PRICE:1
2 10
ITEM:QTY:PRICE:
**************S
T O C K V A L U E******************
ITEM QTY PRICE QTY*PRICE
1 2 10 20
No comments:
Post a Comment