四則演算1
問題
2つのint型変数a, bを用意し、aに80、bに32を代入します。
a+b, a-b, a*b, a/bを計算して表示しましょう。
例
a + b = 112 a - b = 48 a * b = 2560 a / b = 2
解答例
using System; namespace FourArithmeticOperations { class Program { static void Main(string[] args) { int a = 80; int b = 32; Console.WriteLine("a + b = {0}", a + b); Console.WriteLine("a - b = {0}", a - b); Console.WriteLine("a * b = {0}", a * b); Console.WriteLine("a / b = {0}", a / b); } } }