메소드 생성

메소드 생성

import java.util.Scanner; public class Quiz01 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.print("점수를 입력하세요: "); int score1 = scan.nextInt(); int score2 = scan.nextInt(); int score3 = scan.nextInt(); int score4 = scan.nextInt(); System.out.println("평균은 " + getAverage(score1, score2, score3, score4)); } public static double getAverage(int score1, int score2, int score3, int score4) { return (score1 + score2 + score3 + score4)/(double)4; } }

from http://annajin.tistory.com/43 by ccl(A) rewrite - 2021-11-02 17:27:16