Program to calculate profit and lose by C-language
#include<stdio.h>
#include<string.h>
int main()
{
float sp,cp,profit,loss;
printf("Enter cost price\n");
scanf("%f",&cp);
printf("Enter selling price\n");
scanf("%f",&sp);
if(sp>cp)
{
profit=sp-cp;
printf("Profit is %f rupee",profit);
}
else
{
loss=cp-sp;
printf("Loss is %f rupee",loss);
}
}
OUTPUT
Enter cost price
55
Enter selling price
78
Profit is 23.000000 rupee
Interesting sir
ReplyDelete