Demo entry 6360054

1

   

Submitted by anonymous on Apr 30, 2017 at 20:47
Language: Java. Code size: 2.4 kB.

import java.util.*;

public class Exam0328 {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int a, b, namuji; 
		
		System.out.println("약수구하기 프로그램");
		Scanner sc = new Scanner(System.in);
		
		System.out.print("두수 입력 : ");
		a = sc.nextInt();
		b = sc.nextInt();
		
		while(b != 0) {
			namuji = a % b;
			a = b;
			b = namuji;
		}
		System.out.println("최대 공약수 : " + a);
		
		
		int i, n;
		
		System.out.println("약수구하기 프로그램");
		Scanner sc = new Scanner(System.in);
		
		System.out.print("약수 입력 : ");
		n = sc.nextInt();
		
		for(i=1; i<=n; i++) {
			if(n%i==0) {
				if(i==1) {
					continue;
				}
				else {
					System.out.print(" " + i);
				}
			}
		}
		*/
		/*
		Date d = new Date();                       
		int current_hour = d.getHours();           // d.getHours 는 시간을 표시할때 상죵

		System.out.println("현재 시간 : " + d);
		System.out.println("현재 시간 : " + current_hour);

		if(current_hour >=6 && current_hour<=11) {
			System.out.println("아침식사시간");
		}
		else if(current_hour >=12 && current_hour<=17) {
			System.out.println("점심식사시간");
		}
		else if(current_hour >=18 && current_hour<=22) {
			System.out.println("저녁식사시간");
		}
		else {
			System.out.println("잠잘시간");
		}
		*/
		/*
		int jumsu, hakjum;
		
		System.out.println("성적처리 프로그램");
		Scanner sc = new Scanner(System.in);
		
		for(;;) {                                //=while(true)
			System.out.print("점수 입력 : ");
			jumsu = sc.nextInt();
			
			hakjum = jumsu / 10;
			
			switch(hakjum) {
				case 9:
					System.out.println("A학점");
					break;
					
				case 8:
					System.out.println("B학점");
					break;
					
				case 7:
					System.out.println("C학점");
					break;
					
				case 6:
					System.out.println("D학점");
					break;
					
				default:
					System.out.println("F학점");
					break;
			}
		}
		*/
		/*
		int i, j;
		
		for(i=1; i<=5; i++) {                 //가로줄 담당
			for(j=1; j<=5; j++) {             //세로줄 담당
				if(i<=j) {
					System.out.print("*");
				}
				else {
					System.out.print(" ");
				}
			}
			System.out.println();
		}
		*/
		/*
		int i, j;
		
		for(i=1; i<=5; i++) {
			for(j=1; j<=5; j++) {
				if(j<6-i) {
					System.out.print(" ");
				}
				else {
					System.out.print("*");
				}
			}
			System.out.println();
		}
			*/
	}
}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).