Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
WA······哪里出错了?#include<stdio.h> int main() { int n,i,a[101]={0},j,k; long sum; j=0; while( scanf("%d",&n)!=EOF) { if( n==0 ) break; a[j++]=n; } printf("PERFECTION OUTPUT\n"); for( k=0; k<j; k++) { sum=0; for( i=1; i<=a[k]/2; i++) { if( a[k]%i==0 ) sum+=i; if( sum>a[k] ) break; } if( sum==a[k] ) printf("% 5d PERFECT\n",a[k]); if( sum<a[k] ) printf("% 5d DEFICIENT\n",a[k]); if( sum>a[k] ) printf("% 5d ABUNDANT\n",a[k]); } printf("EDN OF OUTPUT\n"); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator