Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main(){
- int num = 0, num_unit = 0, num_cp = 0, num_div_cp = 0, capicua = 1, num_div = 100000;
- cout<<"Numero: "; cin>>num;
- while(num != 0){
- if(num >= num_div){
- num_cp = num;
- num_div_cp = num_div;
- num_unit = num / num_div;
- while(!(num_cp < 10)){
- num_cp %= num_div_cp;
- num_div_cp /= 10;
- }
- num_cp -= num_unit;
- if(num_cp != 0){
- capicua = 0;
- break;
- }
- num %= num_div;
- num -= num_unit;
- num /= 10;
- }else{
- num_div /= 10;
- }
- }
- if(capicua == 1){
- cout<<"Es capicua"<<endl;
- }else{
- cout<<"No es capicua"<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement