Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

1180 - Lowest Number and Position C#

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
using System;
namespace ConsoleApp5
{
    internal class Program
    {
        static void Main(string[] args)
        {
            var SizeOfArray=Convert.ToInt32(Console.ReadLine());
            string[] ValueOfArray = Console.ReadLine().Split(' ');
            
            int[] newArr = new int[SizeOfArray];
            for (int i = 0; i < ValueOfArray.Length; i++)
            {
                newArr[i] = int.Parse(ValueOfArray[i]);
            }
            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}");
        }
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: inline c# custom operator implicit 
Csharp :: Derived classes of abstract class share property 
Csharp :: backcolor app winform C3 
Csharp :: how to check that a gameobject touches a colour in unity c# 
Csharp :: how to find any component of gameobject itself in untiy 
Csharp :: Entity Framework 4 and caching of query results 
Csharp :: collection to datatable c# 
Csharp :: how to use mongodb search index in c# 
Csharp :: c# monogame docs 
Csharp :: call a .NET assembly from C or c++ 
Csharp :: call Textboxfor in cs 
Csharp :: Connect secretclient to proxy 
Csharp :: dictionary and generic class c# 
Csharp :: Retrieving a value in one class that is set in another 
Csharp :: c# code for simplex method 
Csharp :: how do make internet 
Csharp :: unity dictionary foreach remove 
Csharp :: string in char list f# 
Csharp :: wpf string to byte array 
Csharp :: .net mvc foreach with index 
Csharp :: telerik mvc grid unbound column 
Csharp :: How to scroll to bottom of ListBox 
Csharp :: textbox center align winform 
Csharp :: .net check connection 
Csharp :: c# class where T : enum C# 7.03 
Csharp :: windows form button border color 
Csharp :: number to string ef example c# 
Csharp :: unity matchinfo 
Csharp :: populate toolstripitems to combobox 
Csharp :: c# switch two values 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =