0% found this document useful (0 votes)
60 views

Java To Flowchart

The document is code that takes an integer input from the user, iterates from 1 to the input, and builds a string expression by multiplying integers and adding parentheses based on divisibility rules. It initializes variables, gets user input, initializes an output string, then loops through integers up to the input, building the string expression and incrementing counters before outputting the final result.

Uploaded by

Yahya Di Sini
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

Java To Flowchart

The document is code that takes an integer input from the user, iterates from 1 to the input, and builds a string expression by multiplying integers and adding parentheses based on divisibility rules. It initializes variables, gets user input, initializes an output string, then loops through integers up to the input, building the string expression and incrementing counters before outputting the final result.

Uploaded by

Yahya Di Sini
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Scanner in = new Scanner(System.

in)

System.out.print("masukkan input :")

int input = in.nextInt()

int lipat = 1

String output = "1"

int i = 2

i <= input

 True   False 

String temp = Integer.toString(i) System.out.println("output : " + output)

i % 3 == 1 || i % 3 == 2

 True   False 

int j = 1 i % 3 == 0

 True 

 
int j = 1

 
j < lipat

 False   True 

lipat > 1  False  j < lipat

temp= '('+temp+')'  True   False   True 

 False  temp = temp + "x" + Integer.toString(i) temp = "(1/" + temp + ')' lipat > 1

 True 

j++ lipat++  False  temp = temp + "x" + Integer.toString(i)

output = output + "+" + temp j++

i++

You might also like