teddy8 Full Stack Software Engineer

CodeUp - 기초100제(1045)

2019-06-19
teddy8

문제

URL : https://codeup.kr/problemsetsol.php?psid=23


소스코드

// 정수 두 개 입력받아 각종 계산하기 (+, -, *, /, %, /(double))
#include <iostream>

using namespace std;

int main()
{
	int n1, n2;
	cin >> n1 >> n2;
	cout << (n1 + n2) << endl;
	cout << (n1 - n2) << endl;
	cout << (n1 * n2) << endl;
	cout << (n1 / n2) << endl;
	cout << (n1 % n2) << endl;
	cout.precision(11);
	cout << (double)n1 / (double)n2 << endl;
	return 0;
}


Comments

Content