#include<stdio.h>
#include<math.h>
int nguyenTo( int n){
if(n<2) return 0;
for(i=2; i< sqrt(n); i++)
if(n%i==0) return 0;
return 1;
}
int thuanNgich( int n){
int m = n;
int tg = 0;
while(n){ // n>0
tg = tg*10 + n%10;
n/=10;
}
return (tg == m);
}
int main(){
int i;
for(i=10000; i<= 9999999; ++i){
if( thuanNghich(i) && nguyenTo(i) && koCoSo4(i))
printf("%10d", i);
}
getch();
return 0;
}
Đây là bài code của mình ạ. Nhưng mà chỗ code này lại bị báo sai
#include<stdio.h>
#include<math.h>
int nguyenTo( int n){
if(n<2) return 0;
for(i=2; i< sqrt(n); i++)
if(n%i==0) return 0;
return 1;
}
Báo là biến i bị lỗi. Như thế là sao ạ?