Array Methods | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Array Methods

When I write this code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { int[ ] arr = {- 2, -4, -7, -1, 1, 7, 4, 2}; int x =arr[0] + arr.Min(); int y =arr[0] + arr.Max(); Console.WriteLine(arr.Max()); Console.WriteLine(arr.Min()); Console.WriteLine(arr.Sum()); Console.Write(x); Console.Write(y); } } } output comes as under: 7 -7 0 -95 How to write code to get output : 7 -7 0 -9 5

1st Oct 2018, 2:35 PM
kp kalia
kp kalia - avatar
1 Antwort
+ 1
you have used console.write instead of console.writeline in the last 2 output
1st Oct 2018, 3:05 PM
Asgar Aziz
Asgar Aziz - avatar