Lowest price ever! Learn Generative AI for 48% less!
Get my discount+ 1
Readline for arrays (как вводить свои значения??)
Hi I'm Russian, so... Привет Я не понимаю, как вводить свои значения для 46.2, да и остального кода на c#. Вот мой код: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { //введите код сюда int [] arr = {Convert.ToInt32(Console.ReadLine())}; //тут проблема Console.WriteLine(arr.Max()); //это проверка значения int x = arr.Min(); int y = arr.Max(); int sum = x+y; Console.WriteLine("Result: {0}", sum); //Это из урока про do-while } } } И ещё, в описании было написано, что нужно использовать while, но зачем? Спасибо всем, кто поможет простите за украину(
2 Answers
+ 3
// В описании задачи была эта дорога решения
int[] arrint = new int[5];
int i = 0, min,max;
while(i < 5){
arrint[i] = Convert.ToInt32(Console.ReadLine());
i++;
}
min = arrint.Min();
max = arrint.Max();
Console.Write(min+max);
+ 1
Giant thanks for you!