Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- using namespace std;
- void S1(int &a,int &b)
- {
- b=b*10+a%10;
- a=a/10;
- }
- int S2(int k)
- {
- int c=0, p=1;
- while(k>0)
- {
- if(k%2==1)
- {
- c=c+(k%10)*p;
- p=p*10;
- }
- k=k/10;
- }
- return c;
- }
- int main()
- {
- ifstream f("numere.in");
- int n,copie,x;
- f>>n;
- copie=n;
- x=0;
- while(copie>0)
- S1(copie,x);
- if(S2(x)==n)cout<<"DA";
- else cout<<"NU";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement