#include<math.h>
#include<stdio.h>
using namespace std;
int KiemTraChinhPhuong(int n)
{
return sqrt(float(n)) == (int)sqrt((float)n);
}
int SoChinhPhuong(int n)
{
for(int i = 2; i < n; i++)
{
if(KiemTraChinhPhuong(i) == true)
cout<<i<<" ";
}
}
int main()
{
int n;
cout<<"Moi nhap n: ";
cin>>n;
SoChinhPhuong(n);
return 0;
}
0 Nhận xét