Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Punkt A:
- public class Test {
- public static void main(String[] args) {
- int n = 40;
- for(int i=n; i>0; i--)
- {
- if(n%i==0)
- {
- System.out.println(i);
- }
- }
- }
- }
- Punkt B:
- public class Test {
- public static void main(String[] args) {
- int n = 40;
- int a=n;
- while(n>0)
- {
- if(n%a==0)
- {
- System.out.println(a);
- }
- a--;
- if(a==0)
- {
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement