프로그램 설명
숫자의 제곱은 그 숫자에 자신을 곱한 것입니다.
제곱수 또는 완전제곱수는 정수의 제곱인 정수입니다.
완전제곱은 정수의 제곱입니다.
1, 4, 9, 16, 25, 36, 49, 64, 81, 100
다음은 1에서 100까지의 모든 완전제곱근의 제곱근입니다.
√1 = 1 since 12 = 1 √4 = 2 since 22 = 4 √9 = 3 since 32 = 9 √16 = 4 since 42 = 16 √25 = 5 since 52 = 25 √36 = 6 since 62 = 36 √49 = 7 since 72 = 49 √64 = 8 since 82 = 64 √81 = 9 since 92 = 81 √100 = 10 since 102 = 100
완전하지 않은 제곱은 정수를 자신과 제곱한 결과가 아닌 모든 숫자입니다.
아래 숫자는 불완전제곱수입니다.
2,3,5,6,7,8,10,11,12,13,14,15,17,18,19,20,21,22,23,24,26 etc…
알고리즘
Check all numbers from 1 to the user specified number. Check if it is perfect square or not. If not a perfect square, print the Non Perfect Square Number.
예
/* Program to print non square numbers */
#include <stdio.h>
#include <math.h>
int main() {
int number,i,x;
int times = 0;
clrscr();
printf("Print the Non Square Numbers till:");
scanf("%d", &number);
printf("The Non Squre Numbers are:");
printf("\n");
for(i = 1;times<number;i++,times++){
x = sqrt(i);
if(i!=x*x){
printf("%d\t", i);
}
}
getch();
return 0;
} 출력
