约数之和
约数之和
http://www.nowcoder.com/questionTerminal/ac965840491b4f87b6a5131c69546d2b
include<stdio.h>
include<stdlib.h>
main()
{int n,i,sum=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{if(n%i==0)
{sum+=i;}}
printf("%d",sum);
system("pause");}
约数之和
http://www.nowcoder.com/questionTerminal/ac965840491b4f87b6a5131c69546d2b
main()
{int n,i,sum=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{if(n%i==0)
{sum+=i;}}
printf("%d",sum);
system("pause");}
相关推荐