Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.IO;
- using System;
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Hello! Welcome to my shop!");
- Console.WriteLine();
- Console.WriteLine("Enter your name."); // Asking the user to input first variable
- string name = (Console.ReadLine());
- Console.WriteLine();
- Console.WriteLine("Your name is {0}", name);
- Console.WriteLine();
- Console.WriteLine("Enter a number with two decimal places."); // Asking user to enter a number with two decimal points
- double first = double.Parse(Console.ReadLine());
- Console.WriteLine();
- Start:
- Console.WriteLine("Would you like to enter another number? Type Y or N."); // If Else Statement asking if user wants to enter a second number
- string answer = Console.ReadLine();
- double second = 0;
- if (answer == "Y")
- {
- Console.WriteLine("Enter your second number ");
- second = double.Parse(Console.ReadLine());
- }
- else if (answer == "N")
- goto End;
- else
- {
- Console.WriteLine("Invalid answer, please try again.");
- goto Start;
- }
- End:
- {
- double result = first+second;
- Console.WriteLine("Your first number was: {0}", first);
- Console.WriteLine("Your second number was: {0}", second);
- Console.WriteLine($"The sum of the number(s) including GST is {result * 1.15}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement