Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within C# and .NET
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Jeanne Boyarsky
Ron McLeod
Sheriffs:
Paul Clapham
Liutauras Vilda
Devaka Cooray
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
C# and .NET
Help C#
Geno cider
Greenhorn
Posts: 1
posted 2 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Console.Write("Name: "); String name = Console.ReadLine(); Console.Write("Hi " + name + " Please Press desired operator '+' for Add, '-' for Sub, '*' for Mul and '/' for Div"); char operation = Convert.ToChar(Console.Read()); int result; int num1, num2; if (operation == '+') { result = num1 + num2; } else if (operation == '-') { result = num1 - num2; } else if (operation == '*') { result = num1 * num2; } else if (operation == '/') { result = num1 / num2; } else { Console.WriteLine("Invalid Input"); } Console.Write("Enter the First Number: "); { Console.ReadLine(); num1 = Convert.ToInt32(Console.ReadLine()); } Console.Write("Enter the Second Number: "); { Console.ReadLine(); num2 = Convert.ToInt32(Console.ReadLine()); } result = num1 + num2; Console.WriteLine("Result: " + result); Console.Write("Press any key to continue . . . "); Console.ReadKey(true);
Campbell Ritchie
Marshal
Posts: 80222
424
posted 2 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Welcome to the Ranch
I shall move you to the correct forum.
You need to enter the numbers before you try to use them.
Good heavens! What have you done! Here, try to fix it with this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Doubt in Modulus Operator in C
negating an entry in a list
Need help with a small program.
HELP!!!! how does Character.isLetter work? (need experts)
Tomcat: No Java compiler was found
More...