백준 2577 숫자의 개수
Console Programming/C# Console 2019. 10. 15. 17:02using System;
namespace Console1015
{
class Program
{
static void Main(string[] args)
{
int a = int.Parse(Console.ReadLine());
int b = int.Parse(Console.ReadLine());
int c = int.Parse(Console.ReadLine());
int productResult = a * b * c;
string strProductResult = productResult.ToString();
int[] arrProductResult = new int[strProductResult.Length];
for(int i =0; i<strProductResult.Length; i++)
{
arrProductResult[i] = strProductResult[i]-48;
}
int[] count = new int[10];
for (int j =0; j < arrProductResult.Length; j++)
{
for (int k = 0; k < 10; k++)
{
if(arrProductResult[j]==k)
{
count[k]++;
}
}
}
foreach (int num in count)
{
Console.WriteLine(num);
}
}
}
}
'Console Programming > C# Console' 카테고리의 다른 글
백준 10818 최소 최대 (0) | 2019.10.15 |
---|---|
백준 1546 평균 (0) | 2019.10.15 |
2019-10-14 UIPanel 과 Data 클래스 만들기 (수정본) (0) | 2019.10.14 |
2019-10-14 UIPanel 과 Data 클래스 만들기 (0) | 2019.10.14 |
15일차 배열과 컬렉션을 사용해 인벤토리 만들기 (0) | 2019.10.11 |