# include <stdio.h>
# include <math.h>
int main(void)
{
int count;
for (int i = 2; i < 10; i++)
{
count = 0;
if (i == 2)
{
printf("%d \n", i);
}
else // i!= 2
{
for (int j = 1; j <= (int)sqrt(i); j++)
{
if (i%j == 0)
{
count++;
}
}
if (count == 1)
{
printf("%d \n", i);
}
}
}
return 0;
}
'언어 > c언어' 카테고리의 다른 글
네이버 문제 (0) | 2017.09.16 |
---|---|
c언어 3의 배수의 합만 출력 (0) | 2017.08.26 |
두 점 사이의 거리 (0) | 2017.08.25 |
c언어 affine (0) | 2017.08.23 |
회전 (0) | 2017.08.10 |