6.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.

#include<stdio.h>

int main()

{

    float s, p, c;

    printf("Enter the selling price of 15 items: ");

    scanf("%f", &s);

    printf("Enter the profit on 15 items: ");

    scanf("%f", &p);

    c = (s-p)/15;

    printf("\nThe cost price of an item is %f.", c);

    return 0;

}

Comments