Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Intuit // C# // listing_4.7 (case // calculator)
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.IO; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here string buf; double a,b,res; Console.Write("Enter the first operand: "); a = double.Parse(Console.ReadLine()); Console.WriteLine(" a = {0,5}", a); Console.Write("Enter the operation sign:"); char op = (char)Console.Read(); Console.ReadLine(); Console.WriteLine(" op = {0,5}", op); Console.Write("Enter the second operand: "); b = double.Parse(Console.ReadLine()); Console.WriteLine(" b = {0,5}", b); bool ok = true; switch (op){ case '+' : res = a+b; break; case '-' : res = a-b; break; case '/' : res = a/b; break; case '*' : res = a*b; break; case '^' : res = Math.Pow(a,b); break; default : res = double.NaN; ok = false; break; } if (ok) Console.WriteLine("Result is = " + res); else Console.WriteLine("ERROR"); } } }
run
|
edit
|
history
|
help
0
Download a .NET assembly, and execute a static, parameterless method.
Date Conversion
Cotton Farm v: (0.0.0.002)
Interface referance variable
D112
Planet-D ver. 0.7
Pyramid
Convert String to Pig Latin
codetility CyclicRotation
*271*271#