ktra cp TEP
//kiem ra so chinh phuong
#include <stdio.h>
#include <conio.h>
#include <math.h>
#define max 50
long a[max];
int n,i;
int cp(long n)
{
if (floor(sqrt(n))*floor(sqrt(n))==n) return 1;
else return 0;
}
main()
{
FILE *in,*out;
in=fopen("input.txt","r");
out= fopen("output.txt","w");
if (in!= NULL)
{
fscanf(in,"%d",&n);
fprintf(out,"%d
",n);
for(i=1;i<=n;i++)
{
fscanf(in,"%d",&a[i]);
if (cp(a[i])==1) fprintf(out,"yes
");
else fprintf(out,"no
");
}
}
else printf("Loi - Khong mo duoc tep!");
getch();
}
Bạn đang đọc truyện trên: TruyenTop.Vip