Q:-Write a C program to calculate profit and loss on a transaction
This C program to calculate profit or loos helps the user to enter the actual amount and Sales Amount. Using those two values, this C Program will check whether the product is in profit or Loss using Else If.
#include<stdio.h> #include<conio.h> void main() { int cp, sp; clrscr(); printf("Enter the cost price of the product\n"); scanf("%d", &cp); printf("Enter the selling price of the product\n"); scanf("%d", &sp); if(sp > cp) { printf("Your profit is %d\n", (sp-cp)); } else if(cp > sp) { printf("Loss Incurred is %d\n", (cp-sp)); } else { printf("Neither profit, nor loss\n"); } getch(); }