Yaron Shemesh

Yaron Shemesh

  • NA
  • 2
  • 556

What do I need to change in this program?

Jan 15 2018 3:41 PM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApp3
{
class Program
{
static void Main(string[] args)
{
int num1 = 0, num2 = 0;
char c = 'a';
//double result = 0;
Console.WriteLine("Please enter 2 numbers:");
num1 = int.Parse(Console.ReadLine());
num2 = int.Parse(Console.ReadLine());
Console.WriteLine("Please enter the operation sign:");
c = char.Parse(Console.ReadLine()); /
Calc (num1,num2,c); //
}
public static void Calc (int a, int b, char c) // 
{
double result = 0;
int num1 = 0; int num2 = 0;
char sign ='a';
switch (sign)
{
case '+':
result = num1 + num2; break;
case '-':
result = num1 - num2; break;
case '*':
result = num1 * num2; break;
case '/':
result = num1 / num2; break;
}
if (result != 0)
Console.Write(result);
else
Console.Write("This is wrong");
Console.ReadKey();
}
}
}

Answers (1)