約数の計算

約数の計算list_42.c)
#include <stdio.h>

int main()
{
    int s,i;
    printf("**自然数を入力してください : ");
    scanf("%d",&s);
    i=1;
    printf("**約数\n[");
    while(i<=s){
        if(s%i==0) printf("%d,",i);
        i++;
    }
    printf("]\n");
    return 0;
}
実行結果
Gami[87]% list_42.exe
**自然数を入力してください : 14
**約数
[1,2,7,14,]
Gami[88]%
inserted by FC2 system