-
수치 서식 문자열(Standard numeric format strings)코딩Coding/C#_연습 2020. 6. 2. 18:00728x90
수치 서식 문자열
통화 Currency
10진법 Decimal
지수 표기법 Exponential Notation
고정 소수점 Fixed Point
일반 General
숫자 Number
16진법 Hexadecimal
백분율 Percentage
using System; namespace ConsoleApp1 { class Program { static void Main(string[] args) { int a = 12345678; double b = 12.345678; Console.WriteLine("통화 (C) . . . . . . : {0:C}", a); // Currency Console.WriteLine("10진법 (D) . . . . . : {0:D}", a); // Decimal Console.WriteLine("지수 표기법 (E) . . : {0:E}", b); // Exponential Notation Console.WriteLine("고정 소수점 (F) . . : {0:F}", b); // Fixed Point Console.WriteLine("일반 (G) . . . . . . : {0:G}", a); // General Console.WriteLine("숫자 (N) . . . .. . : {0:N}", a); // Number Console.WriteLine("16진법 (X) . . . . . : {0:X}", a); // Hexadecimal Console.WriteLine("백분율 (P) . . . . . : {0:P}", b); // Percentage } } }
결과
https://blog.hexabrain.net/128C# 강좌 3편. 변수, 데이터 형식, 상수 [최근 수정 2017.10.29]
1. 변수(Variable) 변수(variable)란 무엇일까요? 이미 익히 들어보신 분도 계실 거라 생각합니다. 변수는 쉽게 말하면 값을 담아 두는 상자와 같습니다. 변수는 하나의 데이터 값을 가질 수 있으며, 한
blog.hexabrain.net
https://docs.microsoft.com/ko-kr/dotnet/standard/base-types/standard-numeric-format-strings표준 숫자 서식 문자열
표준 숫자 서식 문자열Standard numeric format strings 이 문서의 내용 --> 표준 숫자 서식 문자열은 일반 숫자 형식의 서식을 지정하는 데 사용됩니다.Standard numeric format strings are used to format common numeric ty
docs.microsoft.com
Standard numeric format strings
반응형'코딩Coding > C#_연습' 카테고리의 다른 글
형식 변환(Type Conversion),ToString & Parse Method (0) 2020.06.04 형식 변환(Type Conversion)-정수와 실수 간의 형식 변환 (0) 2020.06.04 출력 너비 지정 (0) 2020.06.04 사용자 지정 수치 서식 문자열(Custom Numeric Format Strings) (0) 2020.06.04 객체 자료형(object) (0) 2020.06.02 논리 자료형(bool)(bool literals) (0) 2020.06.02 문자, 문자열 자료형(char, string) (char literals,string literals) (0) 2020.06.02 실수(real number)자료형(float, double, decimal 형식)(float literals) (0) 2020.06.02