C Program To Calculate Profit Or Loss

 

C Program To Calculate Profit Or Loss

In this example, you will learn to Calculate Profit Or Loss 

How Program Works ??

Profit = S.P - C.P 

Loss = C.P - S.P

(Where S.P is Selling Price and C.P is Cost Price)


Code For  "Calculate Profit Or Loss".


/* Author --> HARSH PATEL */

#include<stdio.h>
int main()
{
  	float Unit_Price, Sales_Amount, Amount;

  	printf("\nEnter the Actrual Product Cost : ");
  	scanf("%f", &Unit_Price);

  	printf("\nEnter the Sale Price (or Selling Price) :  ");
  	scanf("%f", &Sales_Amount);

  	if (Sales_Amount > Unit_Price)
  	{
  		Amount = Sales_Amount - Unit_Price;
  		printf("\nProfit Amount  =  %.4f", Amount);
  	}

  	else if(Unit_Price > Sales_Amount)
       {
    	Amount = Unit_Price - Sales_Amount;
  		printf("\nLoss Amount  =  %.4f", Amount);
	}

  	else
    	printf("\nNo Profit No Loss!");

  return 0;
}
Output-1

Enter the Actrual Product Cost : 2500

Enter the Sale Price (or Selling Price) :  2600

Profit Amount  =  100.0000
Output-2

Enter the Actrual Product Cost : 100

Enter the Sale Price (or Selling Price) :  90

Loss Amount  =  10.0000
Output-3

Enter the Actrual Product Cost : 350

Enter the Sale Price (or Selling Price) :  350

No Profit No Loss!


😊 Some Image Of Program To Calculate Profit Or Loss 




OUTPUT


  • Now Program End Without Any Error.
🖥️ Learn Programming Languages Free In Our Website Coding With Harsh 
👨‍🎓 5000+ Happy Visitor 👩‍🎓
🌐 Free Programing Examples In WebsitCoding With Harsh 

  • If Any Query Regarding Programs, Website Or More Details Email Us On Contact@CodingWithHarsh.gq






Popular posts from this blog

C Program To Check Whether The Number Is Positive Or Negative

C Program To Print Hello World

C Program To Find Total, Average And Percentage Of Five Subjects