#include<stdio.h> #include<string.h> int hui(int x){ int a[100]; int j=0; while(x){ a[j]=x%10; x=x/10; j++; } for(int i=0;i<j;i++){ if(a[i]!=a[j-i-1]){ return 0; break; } } if(i>j/2)return 1; } int iszh(int a){ for(int i=2;i<a;i++){ if(a%i==0){ return 0; } } } int main(){ int n,m;int k=0; scanf("%d %d",&m,&n); for(int i=m;i<=n;i++){ if(hui(i)==1){ if(iszh(i)!=0){ printf("%6d",i); k++; if(k%5==0)printf("\n"); } } } printf("\n"); } /* Main.c: In function 'hui': Main.c:17:5: error: 'i' undeclared (first use in this function) if(i>j/2)return 1; ^ Main.c:17:5: note: each undeclared identifier is reported only once for each function it appears in Main.c:18:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ Main.c: In function 'iszh': Main.c:25:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ */ |
Double click to view unformatted code.