-->
Showing posts with label a program to input cost price and selling price and get profit/loss. Show all posts
Showing posts with label a program to input cost price and selling price and get profit/loss. Show all posts

Write a program to input cost price and selling price and determine whether there is loss or profit.

//Write a program to input cost price and selling price and determine whether there is loss or profit.
#include<stdio.h>
#include<conio.h>
void main()
{
float selling_price,cost_price;
printf("enter cost price \n");
scanf("%f",&cost_price);
printf("enter selling price \n");
scanf("%f",&selling_price);
if(selling_price>cost_price)
    {
          printf("there is profit\n");
          printf(" and profit is=%f\n",selling_price-cost_price);
    }
  else
    {
         printf("there is loss");
         printf(" and loss is=%f\n",cost_price-selling_price);

      }
printf("thank you!!!!\n");
getch();
}