지식인 달아준 문제 약수의 개수가 3개인것
언어/c언어2016. 5. 6. 12:16
#include <stdio.h>
#include <math.h>
#define _AND_ &&
int main(void) {
int End_ = 1110010;
int _Start = 1010110;
int indexI, indexJ, indexK;
int result;
int count = 0;
for (indexI = _Start; indexI <= End_; indexI++) {
result = 1;
for (indexJ = 2; indexJ < (int)sqrt(indexI); indexJ++) {
if (indexI % indexJ == 0) {
break;
}
else {
result = 0;
}
}
if ( result == 0
_AND_ indexI % (int)sqrt(indexI) == 0
_AND_ (indexI /(int)sqrt(indexI)) == (int)sqrt(indexI)
_AND_ (int)sqrt(indexI) % 2 == 1
_AND_ (int)sqrt(indexI) != 1) {
printf("%d \n", indexI);
count++;
}
}
printf("총 [ %d ]개 \n", count);
return 0;
}
'언어 > c언어' 카테고리의 다른 글
네이버 답변 준 코드 링크드 리스트 삭제 (0) | 2016.05.08 |
---|---|
행렬 ver2 (0) | 2016.05.07 |
지식인 답변해준 것 (소수판별) (0) | 2016.05.05 |
queue ver1 (0) | 2016.05.05 |
linkedlist (0) | 2016.05.01 |