Created
November 22, 2018 19:41
-
-
Save dbc2201/a21cb55c75d9fc242df80a2bb361199b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int cp = 0, sp = 0, result = 0; | |
printf("Enter the CP : "); | |
scanf("%d", &cp); | |
printf("Enter the SP: "); | |
scanf("%d", &sp); | |
if ( cp > sp ) | |
{ | |
result = cp - sp; | |
printf("You have incurred a loss of Rs. %d", result); | |
} | |
else if ( sp > cp ) | |
{ | |
result = sp - cp; | |
printf("You have gained a profit of Rs. %d", result); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment