Chapter 2: The Decision control Structure (Let Us C)
(a) If cost price and selling price of an item is input through the keyboard, write a program to determine whether the seller has made profit or incurred loss. Also determine how much profit he made or loss he incurred. // Let Us C (Chapter 2 : The Decision control Structure) : Program-1 /* If cost price and selling price of an item is input through the keyboard, write a program to determine whether the seller has made profit or incurred loss. Also determine how much profit he made or loss he incurred */ #include<stdio.h> double C,S,P,L; void main() { clrscr(); printf("Enter cost price of an item: "); scanf("%lf",&C); printf("Enter Selling price of the same: "); scanf("%lf",&S); if(S>C) { P=S-C; printf("Seller made profit of Rs. %0.2lf",P); } else if(C>S) { L=C-S; printf("Seller incurred loss of Rs. %0.2lf",L); } else if(S==C) ...