# include<stdio.h> void main() { signed int a[3],b[3]; int i,j=0,sum=0,n=1; printf("现在进行三个数求和"); for (i=0;i<3;i++) { printf(" 请输入第%d个数:x=",n++); scanf("%u",&a[i]); if (a[i]>0) { b[j++]=a[i]; sum+=a[i]; } } printf(" 这三个数中正数的和=%d",sum); }
# include<stdio.h> void main() { signed int a[3],b[3]; int i,j=0,sum=0,n=1; printf("现在进行三个数求和"); for (i=0;i<3;i++) { printf(" 请输入第%d个数:x=",n++); scanf("%u",&a[i]); if (a[i]>0) { b[j++]=a[i]; sum+=a[i]; } } printf(" 这三个数中正数的和=%d",sum); }