728x90
반응형
문제
두 정수 A와 B를 입력받은 다음, A×B를 출력하는 프로그램을 작성하시오.
입력
첫째 줄에 A와 B가 주어진다. (0 < A, B < 10)
출력
첫째 줄에 A×B를 출력한다.
예제 입력 1
1 2
예제 출력 1
2
예제 입력 2
3 4
예제 출력 2
12
1
2
3
4
5
6
7
8
9
10
11
|
using System;
class AA{
static void Main(){
string[] aa = Console.ReadLine().Split();
int a = 0;
for(int i = 1; i<=int.Parse(aa[0]); i++){
a += int.Parse(aa[1]);
}
Console.Write(a);
}
}
|
cs |
1
2
3
4
5
6
7
|
using System;
class AA{
static void Main(){
string[] aa = Console.ReadLine().Split();
Console.Write(int.Parse(aa[0])*int.Parse(aa[1]));
}
}
|
cs |
for 문을 사용하거나 *를 사용하여 풀이할 수 있음.
728x90
반응형
'C# > 백준 알고리즘' 카테고리의 다른 글
2022.01.13 [백준] C# 사칙연산 (0) | 2022.01.13 |
---|---|
2022.01.13 [백준] C# A/B (0) | 2022.01.13 |
2022.01.13 [백준] C# A-B (0) | 2022.01.13 |
2022.01.11 [백준] C# A+B (0) | 2022.01.11 |
2022.01.10 [백준] C# 개 (0) | 2022.01.10 |
댓글