回文1
user_3763047219
c_cpp
2 years ago
725 B
2
Indexable
Never
#include <iostream> #include <stdio.h>//header standard Input/ouput #include<stdbool.h> #include<assert.h> #define ARRAYSIZE 5 int main() { int num; int numarray1[ARRAYSIZE]; int numarray2[ARRAYSIZE]; bool arrayequal = true; scanf("%d", &num); if (num < 10000 || num >= 100000) return false; for (int i = 0;i < 5;i++) { numarray1[i] = num % 10 ; numarray2[4 - i] = num % 10; num = num/10; } for (int j=0 ; j < ARRAYSIZE;j++) { if (numarray1[j] != numarray2[j]) arrayequal = false; } if (arrayequal == true) printf("%d", 1); else printf("%d", 0); //if (numarray1 == numarray2)//比較的是兩個矩陣的位置 //printf("%d", 1); //else //printf("%d", 0); }