블로그 이미지
Magic_kit
study 관련자료를 한곳으로 자기 개발 목적으로 재태크 재무 관리 목적으로 일상생활의 팁을 공유 하기 위하여 블로그를 개설 하였습니다.

calendar

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

Category

Recent Post

Recent Comment

Archive

2009. 8. 17. 13:28 .Net Project/.Net C#
반응형


실행화면 )


실행하는 방법에 대한 정의 )


//명령줄 인수(Command Line Prompt) :
// dir c:\ 식으로 명령어 exe 1 ~ 뒤에 따라오는 문자열
//1부터 100까지 3의 배수의 합을 구하는 프로그램
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 명령줄인수
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length<3)
            {
                Console.WriteLine("명령줄인수는 3개 이상 필요합니다");
                return;
               
            }
            int first = Convert.ToInt32(args[0]);
            int second = Int32.Parse(args[1]);
            int num = Convert.ToInt32 (args[2]);
            int sum = 0;
            for (int i = first ; i < second; i++)
            {
                if (i%num == 0)
                {
                    sum += i;
                   
                }
               
            }
            Console.WriteLine("{0} ~ {1}까지 {2}의 배수 합은 :
                                         {3}",first,second,num,sum);
        }
    }
}

반응형
posted by Magic_kit