fork download
  1. #include<stdio.h>
  2. void main()
  3. {
  4. int cost,sale,profit = 0;
  5. float percent =0;
  6. printf("Enter Cost = ");
  7. scanf("%d",&cost);
  8. printf("Enter Sale = ");
  9. scanf("%d",&sale);
  10. if(cost>sale)
  11. {
  12. profit=cost-sale;
  13. printf("Profit = %d\n",profit);
  14. }
  15. else
  16. {
  17. profit=sale-cost;
  18. printf("Profit = %d\n",profit);
  19. }
  20. percent=profit*100/cost;
  21. printf("Percent = %.2f ",percent);
  22. }
Success #stdin #stdout 0s 5300KB
stdin
Standard input is empty
stdout
Enter Cost = Enter Sale = Profit = 1181482622
Percent = 1.00