C#/수업 내용

레벨업

Game Client Lee Hwanguk 2023. 1. 2. 14:33
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace study01
{
    class Program
    {
        static void Main(string[] args)
        {

            //경험치 exp실수형 변수 정의
            //exp변수에 값 할당 28.55
            //exp변수의 값 출력
            //if-else문으로 작성
            //만약 exp값이 100 이상이면 "레벨업" 출력
            //그렇지 않다면 "레벨업 까지 71.45% 남음" 출력
            //if(condition)
            //{
            //}
            //else
            //{
            //}

            const int Max_EXP= 100;
            float exp=28.55f;
            Console.WriteLine("{0:0.00}%",exp);
            if (exp >= 100)

            {
                Console.WriteLine("Level up!");
            }
            else
            {
                float remainExp = Max_EXP - exp;
                Console.WriteLine("레벨업 까지 {0}% 남음", remainExp);
            }
            
        }




    }
}