Skip to content

Instantly share code, notes, and snippets.

@dbc2201
Created November 22, 2018 19:41
Show Gist options
  • Save dbc2201/a21cb55c75d9fc242df80a2bb361199b to your computer and use it in GitHub Desktop.
Save dbc2201/a21cb55c75d9fc242df80a2bb361199b to your computer and use it in GitHub Desktop.
#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