'패스트캠퍼스'에 해당되는 글 1건

using System;
using System.Threading;
using System.Linq;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test
{
    class Program
    {
        int[] arrweek = new int[7]{1,2,3,4,5,6,7};

        /* 성적 프로그램 시작 */
        static void Start()
        {
            Console.WriteLine("성적 프로그램 - Method");
        }

        /* 성적 입력 */
        static void Input(ref int kor, ref int mat, ref int eng)
        {
            Console.Write("국어 성적 입력 : ");
            kor = Int32.Parse(Console.ReadLine());

            Console.Write("수학 성적 입력 : ");
            mat = Int32.Parse(Console.ReadLine());

            Console.Write("영어 성적 입력 : ");
            eng = Int32.Parse(Console.ReadLine());
        }

        /* 입력한 성적의 합 */
        static int Total(int kor, int mat, int eng)
        {
            return kor + mat + eng;
        }

        /* 성적의 평균 */
        static void Average(int total, out float average)
        {
            average = (float)total / 3;
        }

        static void Main(string[] args)
        {
            int kor = 0;
            int eng = 0;
            int mat = 0;
            int total;
            float average;

            Start();
            Input(ref kor, ref eng, ref mat);
            total = Total(kor, mat, eng);
            Average(total, out average);

            Console.WriteLine("Total : {0} / Average : {1}", total, average);
        }
    }
}

 

'프로그래밍 > 코드 정리' 카테고리의 다른 글

[C#] StreamWriter, StreamReader  (0) 2021.04.02
[C#] BitConverter 테스트  (0) 2021.04.02
[C#] 성적 정렬 프로그램  (0) 2021.03.29
[C#] 성적 입력 프로그램  (0) 2021.03.25
[C#] 우승할 달리기 선수 맞추기  (0) 2021.03.21
블로그 이미지

NIA1995

,