Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int ultimacifra(unsigned a,unsigned b)
- {
- int c=a%10;
- if(c==0||c==1||c==5||c==6)
- return c;
- else
- if(c==2)
- {if(b%4==0)
- return 6;
- else
- if(b%4==1)
- return 2;
- else
- if(b%4==2)
- return 4;
- else
- return 8;}
- else
- if(c==3)
- {
- if(b%4==0)
- return 1;
- else
- if(b%4==1)
- return 3;
- else
- if(b%4==2)
- return 9;
- else
- return 7;
- }
- else
- if(c==4)
- {
- if(b%2==0)
- return 6;
- else
- return 4;
- }
- else
- if(c==7)
- {
- if(b%4==0)
- return 1;
- else
- if(b%4==1)
- return 7;
- else
- if(b%4==2)
- return 9;
- else
- return 3;
- }
- else
- if(c==8)
- {if(b%4==0)
- return 6;
- else
- if(b%4==1)
- return 8;
- else
- if(b%4==2)
- return 4;
- else
- return 2;
- }
- else
- if(c==9)
- {
- if(b%2==0)
- return 1;
- else
- return 0;
- }
- }
Add Comment
Please, Sign In to add comment