Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

1180 beecrowd URI

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApp5
{
    internal class Program
    {
        static void Main(string[] args)
        {
            var SizeOfArray=Convert.ToInt32(Console.ReadLine());
            string[] ValueOfArray = Console.ReadLine().Split(' ');
            int OneNum;
            List<int> newArr = new List<int>();
            foreach (string Value in ValueOfArray)
            {
                OneNum=Convert.ToInt32(Value);
                newArr.Add(OneNum);
            }
            int MinN=110;
            int IndexOfNumber=0;
            for(int i = 1; i <= SizeOfArray; i++)
            {
                if (MinN > newArr[i-1])
                {
                    MinN = newArr[i-1];
                    IndexOfNumber = i-1;
                }
            }
            Console.WriteLine($"Menor valor: {MinN}");
            Console.WriteLine($"Posicao: {IndexOfNumber}");
        }
    }
}
Source by www.beecrowd.com.br #
 
PREVIOUS NEXT
Tagged: #beecrowd #URI
ADD COMMENT
Topic
Name
2+3 =