Write a program to input sell price and cost price and find transaction is profit or loss.
About Program
In this program we input sell price and cost price of a product and calculate what happened in this transaction, profit or loss.
For this we need a condition which describe in if block. If sell price is greater than cost price then transaction is profit else loss.
#include<stdio.h>
#include<conio.h>
void main()
{
int sp,cp;
clrscr();
printf("Enter sell price and cost price=");
scanf("%d%d,&sp,&cp);
if(sp>cp)
printf("\nTransaction in Profit");
else
printf("\nTransaction in Loss");
getch();
}
OUTPUT
Enter sell price and cost price=500
400
Transaction in Profit
OR
Enter sell price and cost price=400
500
Transaction in Loss
Related Examples
In this program we input sell price and cost price of a product and calculate what happened in this transaction, profit or loss.
For this we need a condition which describe in if block. If sell price is greater than cost price then transaction is profit else loss.
#include<stdio.h>
#include<conio.h>
void main()
{
int sp,cp;
clrscr();
printf("Enter sell price and cost price=");
scanf("%d%d,&sp,&cp);
if(sp>cp)
printf("\nTransaction in Profit");
else
printf("\nTransaction in Loss");
getch();
}
OUTPUT
Enter sell price and cost price=500
400
Transaction in Profit
OR
Enter sell price and cost price=400
500
Transaction in Loss
Related Examples
- Write a program to input age of any person and check he is eligible for voting or not.
- Write a program to input a number and check number is odd or even.
- Write a program to input two number and find smallest number.
- Write a program to input two number and find highest number.
Share and Comment.
Follow for recently updates.
Comments
Post a Comment