"SWEA 1938 아주 간단한 계산기"의 두 판 사이의 차이

1번째 줄: 1번째 줄:
==개요==
==개요==
;SWEA 1938 아주 간단한 계산기
;SWEA 1938 아주 간단한 계산기
* 더하기(a+b), 빼기(a-b), 곱하기(a*b), 나누기(a/b) 결과를 차례로 출력한다.


{{SWEA 헤더}}
{{SWEA 헤더}}

2019년 1월 21일 (월) 01:24 판

1 개요

SWEA 1938 아주 간단한 계산기
  • 더하기(a+b), 빼기(a-b), 곱하기(a*b), 나누기(a/b) 결과를 차례로 출력한다.
SW Expert 아카데미
# 문제 풀이

틀:SWEA 난이도 1-2

2 C++

#include <iostream>
using namespace std;
int main() {
    int a, b;
    cin >> a >> b;
    cout << a+b << endl;
    cout << a-b << endl;
    cout << a*b << endl;
    cout << a/b << endl;
}

3 Java

import java.util.Scanner;
class Solution {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.println(a+b);
        System.out.println(a-b);
        System.out.println(a*b);
        System.out.println(a/b);
    }
}

4 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}