您好,登錄后才能下訂單哦!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 數(shù)字格式化
{
class Program
{
static void Main(string[] args)
{
int i = 220;
Console.WriteLine("i = {0}",i);
int j = 25;
Console.WriteLine("j = {0}",j);
Console.WriteLine();
/*{參數(shù),占位符(多少個(gè)空格)}*/
Console.WriteLine("{0,6}\n+{1,5}\n-------\n{2,6}",i,j,i+j);
/*
i = 220
j = 25
220
+ 25
-------
245
*/
decimal m = 19.23m;
decimal n = 73.7m;
Console.WriteLine("我現(xiàn)在有{0,5:C2}",m);
Console.WriteLine("然后有{0,7:C2}",n);
Console.WriteLine("{0,8:C2}\n+\n{1,7:C2}\n----------\n{2,8:C2}\n",m,n,m+n);
Console.ReadLine();
}
}
}
/*
i = 220
j = 25
220
+ 25
-------
245
我現(xiàn)在有¥19.23
然后有 ¥73.70
¥19.23
+
¥73.70
----------
¥92.93
*/
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。