C# 程式執行貨幣轉換


假設您需要獲取 10 美元的盧比價值。

Firstly, set the variables:
double usd, inr, val;

現在設定美元並將其轉換為盧比。

// how many dpllars
usd = 10;
// current value of US$
val = 69;
inr = usd * val;

讓我們看看完整的程式碼 −

示例

 即時演示

using System;
namespace Demo {
   public class Program {
      public static void Main(string[] args) {
         Double usd, inr, val;
         // how many dpllars
         usd = 10;
         // current value of US$
         val = 69;
         inr = usd * val;
         Console.WriteLine("{0} Dollar = {1} INR", usd, inr);
      }
   }
}

輸出

10 Dollar = 690 INR

更新時間: 22-6-2020

4K+ 瀏覽

開啟您的 職業

透過完成課程獲得認證

開始
廣告
© . All rights reserved.