Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try
- A=1024;
- B=f1(A);
- disp(B);
- catch exception
- disp(exception)
- end
- function [B]=f1(A)
- if(A<0 || fix(A)~=A)
- H=MException('myComponent:inputErro','Doslo je do greske');
- throw(H);
- end
- if(A==0 || A==1)
- B=A;
- return;
- end
- j=1;i=2;
- while A~=1 && i<=A
- if(notPrime(i)==0 && mod(A,i)==0)
- B(j)=i;j=j+1;
- A=A/i;i=1;
- end
- i=i+1;
- end
- end
- function [y]=notPrime(number)
- y=0;
- for i=2:fix(sqrt(number))
- if(mod(number,i)==0)
- y=1;
- break;
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement