teddy8 Full Stack Software Engineer

CodeUp - 기초100제(1025)

2019-06-18
teddy8

문제

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


소스코드

#include <iostream>
#include <math.h>

using namespace std;

int main()
{
	int n, result;

	cin >> n;

	if (n < 10000 && n > 99999)
	{
		cout << "Input error";
		return -1;
	}

	for (int i = 1; i <= 5; i++)
	{
		result = n / (100000 / pow(10, i));
		n = n % (int)(100000 / pow(10, i));
		cout << "[" << (result * (100000 / pow(10, i))) << "]" << endl;
	}

	return 0;
}


Comments

Content