C Program to find Profit and Loss

Write a C Program to calculate Profit and Loss?

Hi, We are back with another simple program. In this program, we will learn how to write a program to find profit and loss with the use of if-else statement to calculate profit and loss in C Language.

We all have learned about profit and loss in primary mathematics classes. So, If cost price is greater than selling price then there is a loss otherwise it is a profit.

The basic formula to calculate profit and loss
Profit = S.P – C.P (Where S.P is Selling Price and C.P is Cost Price)
Loss = C.P – S.P

Lets see the programming part:

int loss(int selling_price)
int cost,difference;
printf(“%d is profit\n”,difference);
printf(“%d is loss\n”,difference);
int main()
int selling,price,difference;
printf(“enter the price”);
printf(“enter the selling “);
return 0;

Let us know if you have any question or any idea, just leave a comment.