[백준] C# : A/B (1008번)

ssu_hyun·2022년 7월 4일
0

Data Structure & Algorithm

목록 보기
13/67
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Baekjoon
{
    class Program
    {
        static void Main(string[] args)
        {	
        	// 1. 입력받은 문자열을 쪼개 배열에 삽입
            string [] input = Console.ReadLine().Split();
            // 2. int로 형변환해서 두 문자열 나눗셈
            Console.WriteLine(double.Parse(input[0]) / double.Parse(input[1]));
        }
    }
}
  • 실제 정답과 출력값의 절대오차 또는 상대오차가 10-9 이하
    • float : 소수 7번째자리까지만 다룰 수 있다.
    • double : 8바이트로 float의 2배 크기이며, 소수점 15자리까지 정확하게 다룬다.
    • decimal : 소수점 29번째까지 표현할 수 있는 소수 형식

0개의 댓글