Program: 57
Write a c program to find the cost price of one item where selling price and profit is given | Let Us C Solutions
#include<stdio.h> int main() { float s, p, c; //s= selling price, p= profit, c= cost price printf("Enter the selling price of 15 items: "); scanf("%f", &s); printf("Enter the profit on 15 items: "); scanf("%f", &p); //code to calculate cost of an item 'cost price = (selling price - profit)/15' c = (s-p)/15; printf("\nThe cost price of an item is %.2f.", c); return (0); }
Output:
Enter the selling price of 15 items: 150 Enter the profit on 15 items: 45 The cost price of an item is 7.00.
Leave a Comment