输入一个正整数N (1
样例输入
12
样例输出
6
样例说明
12的约数包括:1,2,3,4,6,12。共6个
#include<stdio.h>
int main(){
int n;
scanf("%d",&n);
int i,count=0;
for(i=1;i<=n;i++){
if(n%i==0){
count++;
}
}
printf("%d\n",count);
return 0;
}
12
6
--------------------------------
Process exited after 0.7538 seconds with return value 0
请按任意键继续. . .