Saturday, January 30, 2010

CHAP 1[H]L Finding cost price

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.

void main()
{
float sp,tp,cp,cps;
printf("\nInput the total selling price of 15 itmes and total profit earned respectively");
scanf("%f%f",&sp,&tp);
cps=sp-tp;
printf("\nThe cost price of one item is %f",cp=cps/15.0);

}

No comments:

Post a Comment