Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- unsigned n,nrpar=0,nrimp=0,rang=0,nr;
- cout<<"n=";cin>>n;
- while (n!=0)
- {
- rang++;
- if (rang%2==0)
- nrpar=nrpar*10+n%10;
- else
- nrimp=nrimp*10+n%10;
- n/=10;
- }
- int invnrimp=0,copynrpar=nrpar,p=1;
- while (copynrpar!=0)
- {
- p*=10;
- copynrpar/=10;
- }
- while (nrimp!=0)
- {
- invnrimp=invnrimp*10+nrimp%10;
- nrimp/=10;
- }
- nr=invnrimp*p+nrpar;
- cout<<"noul nr e: "<<nr;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement