Programming/Baekjoon

[for문] 2739. 구구단

Oziraper 2020. 7. 14. 15:40

구구단을 출력하는 문제

N을 입력받은 뒤, 구구단 N단을 출력하는 프로그램을 작성하시오. 출력 형식에 맞춰서 출력하면 된다.

 

C++로 작성했습니다

#include<iostream>
using namespace std; //std 네임스페이스 사용 
int main()
{
	int a;
	cin >> a;
	for (int i = 1; i < 10; i++) {
		int result = a * i;
		cout << a << ' ' << '*' << ' ' << i << ' ' << '=' << ' ' << result << endl;
	}
}