Search for question
Question

Write a C program that calculates price with discount for three different grocery items, andshows output as given sample. The program should run successfully with different scenarios.Program should have following

functions. 1) Function O_item_6 that prompts the user to enter the price per Kg of an item and returns it to the calling function. The price per Kg should be from 0.400 to 4 KWD. If the user enters a price less than 0.400 or greater than 4 KWD then the function should keep asking by using a for loop the user to enter a price until user enters a values from 0.400to 4. (25 points) 2) Function O_Discount_6 that takes price per Kg and weight of item as arguments and returns the final price of an item after applying discount as per the below table. (25points) 3) Function O_Bill_6 that takes the price per Kg of three items Lentils, Rice and Grains by using for loop. (The price per Kg should from 0.400 to 4). The function prompts the user to enter required weight of Item and print final price of an item after discount. It should also print sum of final price of all items after discount, entered till now. The function should return the average price of all three items after the discount has been applied.(25 points) 4) Main function should perform the following tasks. (25 points)Read height value from the user and prints a half pyramid of that height-using a nested while loop as shown in the sample output////.Call only O_Bil_6 function//////Ask the user to continue generating another bill as shown in the sample output.//////Print student's details at end as per sample output.

Fig: 1

Fig: 2

Fig: 3

Fig: 4

Fig: 5

Fig: 6

Fig: 7