Mình đã sai ở đâu vậy ?
#include <iostream>
using namespace std;
void NhapMang(int a[], int n)
{
for (int i=0;i<n;i++)
{
cout << "Phan tu thu " <<i +1 << " ";
cin >> a[i];
}
}
void XuatMang(int a[],int n)
{
for (int i=0;i<n;i++)
{
cout << "Phan tu mang a[" <<i << "] " << a[i]<<endl;
}
}
void KiemTraSNT(int n)
{
bool KT = true;
if(n<2)
{
KT = false ;
}
else
{
if (n > 2 && n%2==0)
{
KT = false;
}
else
{
for (int j=3; j<n;j=j+2)
{
if (n%j==0)
{
KT = false;
break;
}
}
}
}
//return KT;
}
void XuatSoNguyenTo(int a[],int n)
{
for (int i =0; i<n;i++)
{
if (KiemTraSNT(a[i]) == true)
{
cout << a[i] << " ";
}
}
}
void XuatSoSieuNguyenTo(int a[], int n)
{
for (int i =0; i<n;i++)
{
int tam = a[i];
bool KT =true;
while (tam != 0)
{
KT =true;
if (KiemTraSNT(tam) == true)
{
// for (int i )
tam = tam/10;
// cout << a[i] << " ";
}
else
{
KT = false;
break;
}
}
if (KT == true)
{
cout << a[i] <<" ";
}
}
}
int main()
{
int a[100];
int n;
cout <<"Nhap so phan tu cua mang: ";
cin >> n;
NhapMang(a,n);
cout << "XUAT MANG";
XuatMang(a,n);
cout << "\nSo nguyen to";
XuatSoNguyenTo(a,n);
cout << "\nSO sieu nguyen to";
XuatSoSieuNguyenTo(a,n);
return 0;
}