본문 바로가기
TechNical/JAVA

간단한 입출력 프로그램

by 강멍멍이 2009. 11. 9.
반응형
import java.util.Scanner;
public class Round04Homeword2 {

  public static void main(String[] args) {
  // TODO Auto-generated method stub
  String name = "";
  int total = 0;
  Scanner input = new Scanner(System.in);
 
  System.out.println("name:");
  name = input.nextLine();
  System.out.println("nation language:");
  total = total + input.nextInt();
  System.out.println("english:");
  total = total + input.nextInt();
  System.out.println("mathemetics:");
  total = total + input.nextInt();
 
  System.out.printf("Mr.%s, your score is\n", name);
  System.out.printf("total: %d\n",total);
  System.out.printf("avg: %3.2f\n", 1.0*total/3);

 }

}


---------------
결과
---------------
 

name:
kkk
nation language:
100
english:
90
methetics:
100
Mr.kkk, your score is
total: 290
avg: 96.67


참~ 쉽죠잉

반응형

댓글