Console Programming/C# Console
5일차 입력받은 수의 약수 구하기
폰타인
2019. 9. 24. 16:18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Syntax14
{
class Program
{
static void Main(string[] args)
{
//Console.Write("입력 : ");
if (input<1 && input>100)
{
Console.WriteLine("범위를 벗어났습니다.(1~100)");
}
else
{
for(int i =1; i<=input; i++)
{
if (input==i)
{
Console.WriteLine(i);
}
else if (input % i ==0)
{
Console.Write(i);
Console.Write(",");
}
}
}
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoration:none">Colored by Color Scripter
|