Language/Java
DayOfCalendar package com.cal01; public class DayOfCalendar_A { //윤년 계산 -> 해당 년도 해당 월의 일수 계산시 필요 public static boolean isLeapYear(int year) { boolean leap = false; if(year%4==0 && year%100!=0 ||year%400==0) { return true; } return leap; } //일수 계산 -> 해당 년도 해당 월의 일수 리턴 public static int dates(int year, int month) { int date=0; switch(month) { case 0: break; case 2: if(year%4 ==0 && year%100!=0 || ..
Language/Java
package com.test03; import java.util.Scanner; public class Scanner_Calendar { static int year, month, date; public static void main(String[] args) { System.out.print("년, 월, 일로 요일 구하기: "); Scanner sc = new Scanner(System.in); year = sc.nextInt(); month = sc.nextInt(); date = sc.nextInt(); Calendar(year, month, date); sc.close(); } public static void Calendar(int year, int month, int day) { int su..
Language/Java
public class SumX { /* * 1 2 3 4 5 0+1 0+2 0+3 0+4 0+5 * 6 7 8 9 10 5+1 5+2 5+3 5+4 5+5 * 11 12 13 14 15 10+1 10+2 10+3 10+4 * 16 17 18 19 20 15+1 15+2 15+3 15+4 ... * 21 22 23 24 25 20+1 20+2 * 와 같이 출력하고, X의 총합 출력 * * 0.0 0.1 0.2 0.3 0.4 * 1.0 1.1 1.2 1.3 1.4 * */ public static void main(String[] args) { prn(); } public static void prn() { int cnt = 1; int sum = 0; for(int i = 0; i
Language/Java
public class Gugudan { /* * * 2*1=2 * 2*2=4 * 2*3=6 * ... * * 9*8=72 * 9*9=81 * */ public static void main(String[] args) { for (int i = 2; i < 10; i++) { //System.out.printf(""+"\n",i); System.out.println(""); for (int j = 1; j < 10; j++) { //System.out.printf("%d*%d=" + i * j +"\n", i, j, i * j); System.out.printf("%d*%d=%d\n",i,j,(i*j)); } //System.out.println(); } } } 2*1=2 2*2=4 2*3=6 2*4=8..
Language/Java
반복문 반복문이란 프로그램 명령을 반복해서 실행할 수 있는 문법이다. 같은 동작을 반복해야 할 경우 반복문을 통하여 중복되는 코드를 생략하고 간편하게 코드를 작성할 수 있다. 반복문 내의 조건식이 참일 경우 명령을 반복하다가 증감식에 따라 조건이 거짓이 되면 명령 수행을 종료한다. While while 사용 공식 → while(조건) { 명령 }; 조건이 참일 경우 명령을 계속 반복 수행한다. while문 밖에 초기값을 설정하고 while문 내에 증감식을 따로 주어서 반복수행 횟수를 설정할 수 있다. 변수를 while문 밖에 선언하기 때문에 while문이 끝나도 변수가 사라지지 않는다. ※ 반복문의 조건을 true로 바꾸거나, 즉 조건이 참이 되도록 만들면 무한루프가 된다. public class MTe..
Language/Python
우선 다음과 같이 파일이 담겨 있다. [application.py] # -*- coding: utf-8 -*- from flask import Flask, render_template, request app = Flask(__name__) @app.route('/') def root(): return ''' hello ''' @app.route('/hello') @app.route('/hello/') def hello(name=None): return render_template('hello.html', name=name) @app.route('/test', methods=['POST']) def test(): return render_template('test.html', test=request.for..