chiplu

Java sequence

Nov 17th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | None | 0 0
  1. package dadaproject.company;
  2. import java.util.Scanner;
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.  
  7.       int num=22;
  8.       System.out.print(num+" ");
  9.       for(int i=1;i<10;i++)
  10.       {
  11.           if((num/10!=0)&&(num/10!=1))
  12.           {
  13.               num=num/2;
  14.               System.out.print(num+" ");
  15.           }
  16.           else {
  17.               num=(num*3)+1;
  18.               System.out.print(num+" ");
  19.           }
  20.       }
  21.  
  22.     }
  23. }
Add Comment
Please, Sign In to add comment