fork download
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5. int cp,sp,p,l;
  6. printf("enter cp and sp");
  7. scanf("%d%d",&cp,&sp);
  8. if(sp>cp)
  9. {
  10. p=sp-cp;
  11. printf("profit=%d",p);
  12. else
  13. {
  14. if(cp>sp)
  15. {
  16. l=cp-sp;
  17. printf("loss=%d",l);
  18. else
  19. {
  20. printf("no loss or gain");
  21. }
  22. }
  23. }
  24.  
  25. }
  26. return 0;
  27. }
  28.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
30
40
compilation info
prog.c: In function ‘main’:
prog.c:12:2: error: expected ‘}’ before ‘else’
  else
  ^~~~
prog.c:18:3: error: expected ‘}’ before ‘else’
   else
   ^~~~
prog.c: At top level:
prog.c:25:3: error: expected identifier or ‘(’ before ‘}’ token
   }
   ^
prog.c:26:2: error: expected identifier or ‘(’ before ‘return’
  return 0;
  ^~~~~~
prog.c:27:1: error: expected identifier or ‘(’ before ‘}’ token
 }
 ^
stdout
Standard output is empty