Java & Spring/Java Algorithm
[์๋ฐ/ํ์ด์ฌ ์๊ณ ๋ฆฌ์ฆ] ์ต๋๊ฐ ์๊ณ ๋ฆฌ์ฆ
Rainbow๐Coder
2022. 12. 17. 16:09
728x90
๋ก์ง ํ๋ฆ
//[1] Initialize
//[2] Input
//[3] Process : MAX
//[4] Output
์๋ฐ
public class App {
public static void main(String[] args) throws Exception {
//[1] Initialize
int max = Integer.MIN_VALUE;
//[2] Input
int[] nums = {3,56,65,2,2,3,3};
//[3] Process : MAX
for(int x : nums) {
if(x > max){
max = x;
}
}
//[4] Output
System.out.println(max);
}
}
ํ์ด์ฌ
nums = [3,56,65,2,2,3,3]
max = 0
for x in range(len(nums)):
if nums[x] > max :
max =nums[x]
print(max)
ํ์ด์ฌ์ ์ฝ๋๊ฐ ํจ์ฌ ๊ฐ๊ฒฐํ๊ธด ํ๋ฐ... ์ ๋ง ์์ ์ซ์ซ ์ ๋ฌ๋ผ๋ถ๋๋ค ใ ใ
728x90