inblog logo
|
sson17
    자바

    [JAVA]25.점수 평균 구하기

    손영민's avatar
    손영민
    Feb 16, 2025
    [JAVA]25.점수 평균 구하기
     
    package ex03; import java.util.Scanner; public class Averager { public static void main(String[] args) { int total = 0, count = 0; Scanner sc = new Scanner(System.in); while (true) { System.out.print("점수를 입력하시오:"); int grade = sc.nextInt(); if (grade < 0) break; total += grade; count++; } System.out.println("평균은" + total / count); } }
     
     
    notion image
    Share article

    sson17

    RSS·Powered by Inblog