Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions src/main/java/org/example/solution1.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
package org.example;

public class solution1 {
class solution1 {
public double solution(int[] arr) {
double answer = 0;
double tot =0;
for(int i: arr){
tot += i;

for(int i = 0; i < arr.length ; i++){
answer += arr[i];
}
answer = tot/(arr.length);
answer = answer/arr.length;

return answer;
}
}


// 주석에 쓸 내용 : 자신이 이 문제를 어떻게 풀었는지 쓰기, 어려워서 못 풀었으면 어떤 부분이 어려웠는지 남기기.
// solution1에 첫문제 풀고 다음날 부터 솔루션2,3,4.. 클래스 만들어서 풀고 커밋하기
// gpt 사용금지.
//평균 구하기
16 changes: 16 additions & 0 deletions src/main/java/org/example/solution2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.example;

class solution2 {
public String solution(int num) {
String answer = "";
if(num % 2 == 0 ){
answer = "Even";
}
else{
answer = "Odd";
}

return answer;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

깔끔한 코드 🤩

}
//짝수와 홀수