開発環境
- OS: Windows 10 Pro
- IDE(統合開発環境): Visual Studio Community 2017
初めてのC# 第2版 (Jesse Liberty (著)、Brian MacDonald (著)、日向 俊二 (翻訳)、オライリージャパン)の4章(演算子)、4.6(練習問題)、練習4-1.を取り組んでみる。
コード
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Threading; namespace ConsoleApp1 { class Program { static void Main(string[] args) { int x = 25; int y = 5; Console.WriteLine("{0} + {1} = {2}", x, y, x + y); Console.WriteLine("{0} - {1} = {2}", x, y, x - y); Console.WriteLine("{0} * {1} = {2}", x, y, x * y); Console.WriteLine("{0} / {1} = {2}", x, y, x / y); Console.WriteLine("{0} % {1} = {2}", x, y, x % y); } } }
入出力結果(コマンドプロンプト)
25 + 5 = 30 25 - 5 = 20 25 * 5 = 125 25 / 5 = 5 25 % 5 = 0 続行するには何かキーを押してください . . .
0 コメント:
コメントを投稿