Guest User

Untitled

a guest
Mar 23rd, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. class Program
  2. {
  3. static void Main(string[] args)
  4. {
  5. Console.WriteLine("Hello! Welcome to my shop!");
  6. Console.WriteLine();
  7. Console.WriteLine("Enter your name."); // Asking the user to input first variable
  8. var name = (Console.ReadLine());
  9. Console.WriteLine();
  10. Console.WriteLine("Enter a number with two decimal places."); // Asking user to enter a number with two decimal points
  11. var first = double.Parse(Console.ReadLine());
  12. Console.WriteLine();
  13. Start:
  14. 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
  15.  
  16. var answer = Console.ReadLine();
  17.  
  18. if (answer == "Y")
  19.  
  20. {
  21. Console.WriteLine("Enter your second number ");
  22. var second = double.Parse(Console.ReadLine());
  23. }
  24.  
  25.  
  26. else if (answer == "N")
  27. goto End;
  28.  
  29.  
  30. else
  31. {
  32. Console.WriteLine("Invalid answer, please try again.");
  33. goto Start;
  34. }
  35. var result = first+second;
  36. End:
  37. {
  38. Console.WriteLine($"The sum of the number(s) including GST is {result * 1.15}");
  39. }
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment