Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package allQuestions;
- public class QuestionTwo {
- public int extended (int a , int n){
- int x0 = 1 , x1 = 0 , r0 = a , r1 = n ,r=1 , q , x=0 ;
- while (a%n !=0){
- r = a % n;
- q = a/n;
- x = x0 - q*x1;
- x0 = x1;
- x1 = x;
- a = n ;
- n = r ;
- }
- return x;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement