fork download
  1. #include<stdio.h>
  2. int main()
  3. {
  4. float b, s, p;
  5. printf("Buy: ");
  6. scanf("%f",&b);
  7. printf("Sell: ");
  8. scanf("%f",&s);
  9. if(s>b){
  10. p=s-b;
  11. printf("\nProfit %f %%",p/b*100);
  12. }
  13. else{
  14. p=b-s;
  15. printf("\nLoss %f %%",p/b*100);
  16. }
  17. }
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
Buy: Sell: 
Loss 100.000000 %