Huyu "The coder"
New member
- Joined
- Jul 15, 2024
- Messages
- 1
- Programming Experience
- Beginner
C#:
using System;
namespace tryingcalculator
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("------------");
Console.WriteLine(" Calculator");
Console.WriteLine("------------");
Console.WriteLine("");
Console.WriteLine("Enter your username");
Console.WriteLine("");
String username = Console.ReadLine();
Console.WriteLine("");
Console.WriteLine("hello " + username);
Console.WriteLine("");
Console.WriteLine("do you want to use to use the calculator?");
Console.WriteLine("");
String use = Console.ReadLine();
if (use== "yes") {
Console.WriteLine("");
Console.WriteLine("What is the first number of your equation? ");
Console.WriteLine("");
int num1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("");
Console.WriteLine("What is the second number of your equation? ");
Console.WriteLine("");
int num2 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Choose from this options");
Console.WriteLine("+");
Console.WriteLine("-");
Console.WriteLine("*");
Console.WriteLine("/");
String option = Console.ReadLine();
if (option=="+") {
Console.WriteLine(num1 + num2);
}
Console.WriteLine("");
if (option == "-")
{
Console.WriteLine(num1 - num2);
}
if (option == "*")
{
Console.WriteLine(num1 * num2);
}
if (option == "/")
{
Console.WriteLine(num1 / num2);
}
if(use == "no")
{
Console.WriteLine("So why tf did you open the app?!");
}
}
Console.ReadKey();
}
}
}
Last edited by a moderator: