Language: C

#include <stdlib.h>
#include <string.h>
#include <math.h>
int main()
{
    int a,b,c,d,m;
    while(scanf("%d",&m)!=EOF)
    {   a=m/1000;
        b=(m-1000*a)/100;
        c=m%100/10;
        d=m%10;
        if(a+b+c+d==7)printf("%d+%d+%d+%d=7\n",a,b,c,d);
        else if(a+b+c-d==7)printf("%d+%d+%d-%d=7\n",a,b,c,d);
        else if(a+b-c+d==7)printf("%d+%d-%d+%d=7\n",a,b,c,d);
        else if(a-b+c+d==7)printf("%d-%d+%d+%d=7\n",a,b,c,d);
        else if(a+b-c-d==7)printf("%d+%d-%d-%d=7\n",a,b,c,d);
        else if(a-b-c+d==7)printf("%d-%d-%d+%d=7\n",a,b,c,d);
        else if(a-b+c-d==7)printf("%d-%d+%d-%d=7\n",a,b,c,d);
    }
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:7:11: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    7 |     while(scanf("%d",&m)!=EOF)
      |           ^~~~~
main.c:4:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
    3 | #include <math.h>
  +++ |+#include <stdio.h>
    4 | int main()
main.c:7:11: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    7 |     while(scanf("%d",&m)!=EOF)
      |           ^~~~~
main.c:7:11: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:7:27: error: 'EOF' undeclared (first use in this function)
    7 |     while(scanf("%d",&m)!=EOF)
      |                           ^~~
main.c:7:27: note: 'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
main.c:7:27: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:23: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   12 |         if(a+b+c+d==7)printf("%d+%d+%d+%d=7\n",a,b,c,d);
      |                       ^~~~~~
main.c:12:23: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:12:23: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:12:23: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:13:28: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   13 |         else if(a+b+c-d==7)printf("%d+%d+%d-%d=7\n",a,b,c,d);
      |                            ^~~~~~
main.c:13:28: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:14:28: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   14 |         else if(a+b-c+d==7)printf("%d+%d-%d+%d=7\n",a,b,c,d);
      |                            ^~~~~~
main.c:14:28: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:15:28: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   15 |         else if(a-b+c+d==7)printf("%d-%d+%d+%d=7\n",a,b,c,d);
      |                            ^~~~~~
main.c:15:28: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:16:28: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   16 |         else if(a+b-c-d==7)printf("%d+%d-%d-%d=7\n",a,b,c,d);
      |                            ^~~~~~
main.c:16:28: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:17:28: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   17 |         else if(a-b-c+d==7)printf("%d-%d-%d+%d=7\n",a,b,c,d);
      |                            ^~~~~~
main.c:17:28: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:18:28: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   18 |         else if(a-b+c-d==7)printf("%d-%d+%d-%d=7\n",a,b,c,d);
      |                            ^~~~~~
main.c:18:28: note: include '<stdio.h>' or provide a declaration of 'printf'