To find the solutions I wrote the following code.
Code: Select all
#include <stdio.h>
int main ()
{
int a,b,c,d,n;
for(a=1;a>=0 && a<=7;a++)
{for(b=1;b>=0 && b<=7;b++)
{for(c=1;c>=0 && c<=7;c++)
{for(d=1;d>=0 && d<=7;d++)
{
n = a + b + c + d;
if(n==7)
{
printf("%d %d %d %d\n",a,b,c,d);
}}}}}
system("pause");
return 0;
}