Q7 If the total selling price of 15 items and the total profit earned on them is input through the keyboard. Write a program to find the cost price of one item.

Find cost price of an item

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.

Lokesh Kumar: Being EASTER SCIENCE's founder, Lokesh Kumar wants to share his knowledge and ideas. His motive is "We assist you to choose the best", He believes in different thinking.
Related Post
Leave a Comment

This website uses cookies.