#include <stdio.h>
#include <math.h>
main()
{
int i,j,k,l,m,p,temp;
int a=0,b;
int stor[5],*sum;
for (i=1;i<=20;i++)
for (j=i+1;j<=20;j++)
for (k=j+1;k<=20;k++)
for (l=k+1;l<=20;l++)
for (m=l+1;m<=20;m++)
{
stor[0]=i;
stor[1]=j;
stor[2]=k;
stor[3]=l;
stor[4]=m;
temp=stor[0]+stor[1]+stor[2]+stor[3]+stor[4];
if (temp==65)
{
*sum=NULL;
*sum=temp;
for (p=0;p<5;p++)
{
printf("%4d",stor[p]);
}
printf(" sum=%d\n",*sum);
sum++;
a++;
}
}
printf("number is:%4d\n",a);
printf("please enter any key to end this program!");
scanf("%c",&b);
}
可以试试这个!