代码文本:
#include "stdio.h"
int main(int argc,char *argv[]){
int n,t,k;
printf("Enter n(int n>0)...\nn=");
if(scanf("%d",&n)==1 && n>0)
while(n){
for(t=n,k=0;t;k+=t%10,t/=10);
if(n%k==0){
printf("The result is %d.\n",n);
break;
}
n++;
}
else
printf("Input error, exit...\n");
return 0;
}