Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;// ||sau
- int main() {
- unsigned n,k,p=1,inv=0,inv2=0,nrcif=0;
- cout<<"n=";cin>>n;
- cout<<"k=";cin>>k;
- int cn=n;
- while (n!=0)
- {
- nrcif++;
- n/=10;}
- if (nrcif<k)
- {
- cout<<"imposibil";
- return 0;
- }
- while (cn!=0)
- {
- inv=inv*10+cn%10;
- cn/=10;
- }
- while (k!=0)
- {
- p*=10;
- k--;
- }
- inv/=p;
- while (inv!=0)
- {
- inv2=inv2*10+inv%10;
- inv/=10;
- }
- cout<<"acu nr e: "<<inv2;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement