You are on page 1of 1

/*

* To change this license header, choose License Headers in Project Properties.


* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package percobaan;
/**
*
* @author Tri Nugroho
*/
import java.util.Scanner;
public class NewClass {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {

int x=1;
int i=0;
int angka;
String hasil="1";
System.out.print("masukan : ");
Scanner sken= new Scanner(System.in);
int masuk=sken.nextInt();
int masukan=masuk-1;
while(i<masukan){
while(x<4){
if(i<masukan){
x++;
hasil=hasil+"+"+x;
}else{
break;
}
i++;
}

while(x>1){
if(i<masukan){
x--;
hasil=hasil+"+"+x;
}else{
break;
}
i++;
}
}

System.out.print(hasil);
// TODO code application logic here
}

}

You might also like