• Follow Us

Profit and Loss Program in C

how to find the profit and loss by using C programming language.

What is Profit?

Profit= Selling Price-Cost Price What is Loss? Loss= Cost Price- Selling Price

C Program to find the profit and Loss

#include<stdio.h>
int main()
{
    int num,cp,sp,profit;
    printf("Enter the number of products\n");
    scanf("%d",&num);
    printf("Enter the cost of 1 producs\n");
    scanf("%d",&cp);
    printf("Enter the cost spent by the agency on 1 product\n");
    scanf("%d",&sp);
    r=num*cp-((num*sp)+100);
    printf("The profit obtained is Rs.%d",profit);
    return 0;
}

In the above program if the profit is negative then its a loss.  ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *

Shopping cart