fork download
  1. #include <stdio.h>
  2. int max_1;
  3. int max(int x, int y, int m, int n)
  4. {
  5. int number=x;
  6. while(1)
  7. {
  8.  
  9. if(number%y==0)
  10. {
  11. max_1=number;
  12. break;
  13. }
  14. number+=m;
  15. }
  16. }
  17.  
  18. int divide(int x, int y, int m, int n)
  19. {
  20. int temp, number=x, number_1=0;
  21. while(1)
  22. {
  23. if(x==m && y==n)
  24. {
  25. if()
  26. return -1;
  27. }
  28. if(number>max_1)
  29. return -1;
  30. if(number%n==y)
  31. return number;
  32. number+=m;
  33. }
  34.  
  35. }
  36. int main(void)
  37. {
  38. int T, x, y, m, n;
  39. scanf("%d", &T);
  40. for(int i=0; i<T; ++i)
  41. {
  42. scanf("%d %d %d %d", &m, &n, &x, &y);
  43. max(x, y, m, n);
  44. printf("%d\n", divide(x, y, m, n));
  45. }
  46. return 0;
  47. }
Compilation error #stdin compilation error #stdout 5s 4444KB
stdin
2
10 12 3 9
13 11 5 6
compilation info
prog.c: In function ‘divide’:
prog.c:25:7: error: expected expression before ‘)’ token
    if()
       ^
prog.c:20:22: warning: unused variable ‘number_1’ [-Wunused-variable]
  int temp, number=x, number_1=0;
                      ^~~~~~~~
prog.c:20:6: warning: unused variable ‘temp’ [-Wunused-variable]
  int temp, number=x, number_1=0;
      ^~~~
prog.c: In function ‘max’:
prog.c:16:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
prog.c: In function ‘main’:
prog.c:39:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &T);
  ^~~~~~~~~~~~~~~
prog.c:42:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d %d", &m, &n, &x, &y);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
stdout
Standard output is empty