перераспределить значения переменных х и у так чтобы в х оказалось большее из этих значений а в у меньшее C#
Ответы на вопрос
Ответил Milton812
0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace pzn
{
class Program
{
public static void Main(string[] args)
{
int x = Convert.ToInt32(Console.ReadLine());
int y = Convert.ToInt32(Console.ReadLine());
int temp;
if (x<y)
{
x ^= y;
y ^= x;
x ^= y;
}
Console.WriteLine("x={0}, y={1}", x, y);
Console.ReadKey();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace pzn
{
class Program
{
public static void Main(string[] args)
{
int x = Convert.ToInt32(Console.ReadLine());
int y = Convert.ToInt32(Console.ReadLine());
int temp;
if (x<y)
{
x ^= y;
y ^= x;
x ^= y;
}
Console.WriteLine("x={0}, y={1}", x, y);
Console.ReadKey();
}
}
}
Ответил dautov1
0
спасибо
Новые вопросы
Математика,
2 года назад
Математика,
2 года назад
Физика,
8 лет назад
Алгебра,
8 лет назад
Математика,
9 лет назад