Advertisement
Uriel133

All6

May 7th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. // 2
  2. Console.WriteLine("Enter 2 number");
  3. int x = int.Parse(Console.ReadLine());
  4. int y = int.Parse(Console.ReadLine());
  5. int sum = 0;
  6. for (int i = 1; i <= y; i++)
  7. {
  8. sum = sum + i * (i + x);
  9. }
  10. Console.WriteLine("The result is " + sum);
  11.  
  12. // 3
  13. double x = double.Parse(Console.ReadLine());
  14. char op = char.Parse(Console.ReadLine());
  15. double y = double.Parse(Console.ReadLine());
  16. while (x != 0 && y != 0)
  17. {
  18. if (op == '+')
  19. {
  20. Console.WriteLine("= " + (x + y));
  21. }
  22. if (op == '-')
  23. {
  24. Console.WriteLine("= " + (x - y));
  25. }
  26. if (op == '*')
  27. {
  28. Console.WriteLine("= " + (x * y));
  29. }
  30. if (op == '/')
  31. {
  32. Console.WriteLine("= " + (x / y));
  33. }
  34. x = double.Parse(Console.ReadLine());
  35. op = char.Parse(Console.ReadLine());
  36. y = double.Parse(Console.ReadLine());
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement