Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 2
- Console.WriteLine("Enter 2 number");
- int x = int.Parse(Console.ReadLine());
- int y = int.Parse(Console.ReadLine());
- int sum = 0;
- for (int i = 1; i <= y; i++)
- {
- sum = sum + i * (i + x);
- }
- Console.WriteLine("The result is " + sum);
- // 3
- double x = double.Parse(Console.ReadLine());
- char op = char.Parse(Console.ReadLine());
- double y = double.Parse(Console.ReadLine());
- while (x != 0 && y != 0)
- {
- if (op == '+')
- {
- Console.WriteLine("= " + (x + y));
- }
- if (op == '-')
- {
- Console.WriteLine("= " + (x - y));
- }
- if (op == '*')
- {
- Console.WriteLine("= " + (x * y));
- }
- if (op == '/')
- {
- Console.WriteLine("= " + (x / y));
- }
- x = double.Parse(Console.ReadLine());
- op = char.Parse(Console.ReadLine());
- y = double.Parse(Console.ReadLine());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement