5일차 입력받은 수의 약수 구하기
Console Programming/C# Console 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
|
'Console Programming > C# Console' 카테고리의 다른 글
성적입력 프로그램 2일차 (0) | 2019.09.24 |
---|---|
5일차 최대공약수 구하기 (0) | 2019.09.24 |
5일차 1~20까지 숫자중 3의배수 이고 6의배수인 값의 합을 출력 (0) | 2019.09.24 |
5일차 year를 입력받아 윤년인지 아닌지 판별하기 (0) | 2019.09.24 |
5일차 세 개의 정수를 입력받아 두번째로 큰 수 출력 --------코드 수정 (0) | 2019.09.24 |