- Joined
- Apr 7, 2017
- Posts
- 7,994
- Solutions
- 1
- Reaction
- 4,324
- Points
- 2,365
sa compiler ba to o need tlga visual studio Wala kasi along pc
tamang nood din ako ng tutorial pero ayaw tlga gumana sa mga compiler
gagawa kasi kami ng simple calculator sana tulad nitong sa pic pls help me bukas na eh
tamang nood din ako ng tutorial pero ayaw tlga gumana sa mga compiler
gagawa kasi kami ng simple calculator sana tulad nitong sa pic pls help me bukas na eh
C#:
int num1;
int num2;
string operand;
float answer;
Console.WriteLine("Enter Num1:\n");
num1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter your desired operator: (+, *, -, /):\n");
operand = Console.ReadLine();
Console.WriteLine("Enter Num2:\n");
num2 = Convert.ToInt32(Console.ReadLine());
switch(operand)
{
case"+":
answer = num1 + num2;
break;
case"*":
answer = num1 * num2;
break;
case"-":
answer = num1 - num2;
break;
case"/":
answer = num1 / num2;
break;
}
Console.WriteLine("Your answer is:\n" + num1.ToString() + " " + operand + " " + num2.ToString() + " = " + answer.ToString());
Console.ReadLine();
Attachments
-
You do not have permission to view the full content of this post. Log in or register now.
Last edited: