Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. package allQuestions;
  2.  
  3. public class QuestionTwo {
  4.  
  5.  
  6. public int extended (int a , int n){
  7. int x0 = 1 , x1 = 0 , r0 = a , r1 = n ,r=1 , q , x=0 ;
  8. while (a%n !=0){
  9. r = a % n;
  10. q = a/n;
  11. x = x0 - q*x1;
  12. x0 = x1;
  13. x1 = x;
  14. a = n ;
  15. n = r ;
  16.  
  17. }
  18. return x;
  19. }
  20.  
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement