fork download
  1. #include <stdio.h>
  2. #include<math.h>
  3.  
  4. float f1(int x, int a)
  5. { float y;
  6. if(a>=1)
  7. y=(pow(x,a)+sqrt(x)+3)%a;
  8. else if(a>1&&a<x)
  9. y=pow(a,x+2)+exp(a);
  10. return y;
  11. }
  12. void main()
  13. {
  14. int x,a;
  15. float y;
  16. printf("enter 2 integers \n");
  17. scanf("%d%d"&x,&a);
  18. y=f1(x,a);
  19. printf("%f"y);
  20.  
  21. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘f1’:
prog.c:7:23: error: invalid operands to binary % (have ‘double’ and ‘int’)
 y=(pow(x,a)+sqrt(x)+3)%a;
   ~~~~~~~~~~~~~~~~~~~~^
prog.c: At top level:
prog.c:12:6: warning: return type of ‘main’ is not ‘int’ [-Wmain]
 void main()
      ^~~~
prog.c: In function ‘main’:
prog.c:17:14: error: invalid operands to binary & (have ‘char *’ and ‘int’)
  scanf("%d%d"&x,&a);
        ~~~~~~^
prog.c:19:13: error: expected ‘)’ before ‘y’
  printf("%f"y);
             ^
prog.c:19:11: warning: format ‘%f’ expects a matching ‘double’ argument [-Wformat=]
  printf("%f"y);
           ^
prog.c:15:8: warning: variable ‘y’ set but not used [-Wunused-but-set-variable]
  float y;
        ^
stdout
Standard output is empty