Saturday 15 October 2011

(l) 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<conio.h>
#include<stdio.h>
int main()
{
    float cost, sale, costitem, profit;

    printf("Please enter total selling price of 15 items: ");
    scanf("%f",&sale);
   
    printf("\nNow enter total profit on 15 items: ");
    scanf("%f",&profit);
   
    //Calculations
    cost = sale - profit;
    costitem = cost / 15;

   
    printf("\nCost price per item: %f",costitem);
   
    getche();
}



1 comment:

  1. Thankyou otherwise I would have added sale and profit in paper.

    ReplyDelete