|
| 1 | +#include <stdio.h> |
| 2 | +int main() |
| 3 | +{ |
| 4 | + int pr_code, qty= 0; |
| 5 | + int r1 = 500; |
| 6 | + int r2 = 800; |
| 7 | + int r3 = 600; |
| 8 | + int r4 = 1000; |
| 9 | + int r5 = 700; |
| 10 | + float total, dis, payable; |
| 11 | + |
| 12 | + printf("5431 Fries 500\n"); |
| 13 | + printf("2331 Rice 800\n"); |
| 14 | + printf("7856 Bread 600\n"); |
| 15 | + printf("9987 Beef 1000\n"); |
| 16 | + printf("8865 Milk 700\n"); |
| 17 | + |
| 18 | + printf("Enter Product Code: "); |
| 19 | + scanf("%d", &pr_code); |
| 20 | + |
| 21 | + printf("Enter Quantity: "); |
| 22 | + scanf("%d", &qty); |
| 23 | + |
| 24 | + if(pr_code==5431) |
| 25 | + { |
| 26 | + printf("Product Code Product Name Rate Quantity "); |
| 27 | + printf("5431 Fries 500 %d", qty); |
| 28 | + printf("\nTotal Price : %f\n",total = r1 * qty); |
| 29 | + } |
| 30 | + |
| 31 | + else if(pr_code==2331) |
| 32 | + { |
| 33 | + printf("\nProduct Code Product Name Rate Quantity \n"); |
| 34 | + printf("2331 Rice 800 %d", qty); |
| 35 | + printf("\nTotal Price : %f\n",total = r2 * qty); |
| 36 | + } |
| 37 | + |
| 38 | + else if(pr_code==7856) |
| 39 | + { |
| 40 | + printf("\nProduct Code Product Name Rate Quantity \n"); |
| 41 | + printf("7856 Bread 600 %d", qty); |
| 42 | + printf("\nTotal Price : %f\n",total = r3 * qty); |
| 43 | + } |
| 44 | + |
| 45 | + else if(pr_code==9987) |
| 46 | + { |
| 47 | + printf("\nProduct Code Product Name Rate Quantity \n"); |
| 48 | + printf("9987 Beef 1000 %d", qty); |
| 49 | + printf("\nTotal Price : %f\n",total = r4 * qty); |
| 50 | + } |
| 51 | + |
| 52 | + else if(pr_code==8865) |
| 53 | + { |
| 54 | + printf("\nProduct Code Product Name Rate Quantity \n"); |
| 55 | + printf("8865 Milk 700 %d", qty); |
| 56 | + printf("\nTotal Price : %f\n",total = r5 * qty); |
| 57 | + } |
| 58 | + |
| 59 | + else |
| 60 | + printf("\nEnter Correct Code"); |
| 61 | + |
| 62 | + if (total > 10000) |
| 63 | + { |
| 64 | + dis = (total * 0.1); |
| 65 | + payable = (float)total - dis; |
| 66 | + |
| 67 | + printf("Discounted Price = Rs %f\n", dis); |
| 68 | + printf("Total expenses = Rs %f\n", payable); |
| 69 | + } |
| 70 | + |
| 71 | + else |
| 72 | + printf("\nTotal Amount = Rs %f", total); |
| 73 | + |
| 74 | + return 0; |
| 75 | +} |
0 commit comments