Take the price and quantity of items as an input. Write a C function to calculate the sum of the prices. Write another C function to calculate the discount according to the following rules: For total less than Rs.1000, discount is 5%. For total greater than Rs.1000 but less than Rs.5000, discount is 10%. For total greater than Rs.5000, discount is 15%. Write another function to print the individual item prices, total, discount and the final price.
Answers
Answered by
3
Given: price is given
To Find: sum of prices
solution:
#include<stdio.h>
main()
{
int price, quant;
printf("enter price and qunatity of items");
scanf("%d %d , &price, &quant);
int sum=price * quant;
int total ;
printf(" total price %d", sum);
if( sum< 1000)
{
int d=(sum* 5)/100;
total=sum-d;
}
else if(sum>1000 && sum<5000)
{
int d=(sum* 10)/100;
total=sum-d;
}
else if( sum>5000)
{
int d=(sum* 15)/100;
total=sum-d;
}
printf ("final price =%d discount=%d, total, d);
}
Answered by
0
Answer:
Explanation:not able to solve this problem
Similar questions