Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 4
- Console.WriteLine("Enter 2 numbers");
- int x = int.Parse(Console.ReadLine());
- int y = int.Parse(Console.ReadLine());
- int d = x % y;
- if (d == 0)
- {
- Console.WriteLine(x + " divides " + y);
- }
- else
- {
- Console.WriteLine(x + " not divides " + y);
- }
- // 5
- Console.WriteLine("Enter a number, operator and number");
- int x = int.Parse(Console.ReadLine());
- char c = char.Parse(Console.ReadLine());
- int y = int.Parse(Console.ReadLine());
- if (c == '+')
- {
- Console.WriteLine(x + y);
- }
- if (c == '*')
- {
- Console.WriteLine(x * y);
- }
- if (c == '-')
- {
- Console.WriteLine(x - y);
- }
- if (c == '/' && y == 0)
- {
- Console.WriteLine("Error");
- }
- if (c == '/')
- {
- Console.WriteLine(x / y);
- }
- // 6
- Console.WriteLine("Welcome to the bar, enter your age");
- int age = int.Parse(Console.ReadLine());
- if (age < 18)
- {
- Console.WriteLine("Sorry");
- }
- else
- {
- Console.WriteLine("Great. choose 'b' for beer, 'w' for wine");
- char c = char.Parse(Console.ReadLine());
- if (c == 'b')
- {
- Console.WriteLine("Your beer is ready");
- }
- if (c == 'w')
- {
- Console.WriteLine("Your wine is ready");
- }
- // 7
- Console.WriteLine("Enter heart rate");
- int hr = int.Parse(Console.ReadLine());
- Console.WriteLine("Enter week");
- int wk = int.Parse(Console.ReadLine());
- if (wk >= 1 && wk <= 2)
- {
- if (hr <= 60)
- {
- Console.WriteLine("You need to run 3 km");
- }
- if (hr >= 61 && hr <= 70)
- {
- Console.WriteLine("You need to run 3 km");
- }
- if (hr > 71)
- {
- Console.WriteLine("You need to run 3 km");
- }
- }
- if (wk >= 3 && wk <= 4)
- {
- if (hr <= 60)
- {
- Console.WriteLine("You need to run 5 km");
- }
- if (hr >= 61 && hr <= 70)
- {
- Console.WriteLine("You need to run 5 km");
- }
- if (hr > 71)
- {
- Console.WriteLine("You need to run 3 km");
- }
- }
- if (wk >= 5)
- {
- if (hr <= 60)
- {
- Console.WriteLine("Tou need to run 10 km");
- }
- if (hr >= 61 && hr <= 70)
- {
- Console.WriteLine("You need to run 8 km");
- }
- if (hr > 71)
- {
- Console.WriteLine("You need to run 3 km");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement