Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

array hw exercise

namespace ConsoleApp1
{
    internal class Program
    {
        static void Main(string[] args)
		{
            int sum = 0;
            int mult = 1;
            int[] numbers = new int[10];
            Console.WriteLine("Input ten numbers:");
            for(int i = 0; i<numbers.Length; i++)
            {
                numbers[i] = Convert.ToInt32(Console.ReadLine());
            }
            Console.WriteLine("Here is your output:");
            for (int i = 0; i < numbers.Length; i++)
            {
               Console.WriteLine(numbers[i]);
            }
            Console.WriteLine("Even Number sum:");
            for (int i = 0; i < numbers.Length; i++)
            {
                if (i % 2 != 1) 
                {
                    sum = sum + numbers[i];
                }
            }
            Console.WriteLine(sum);
            Console.WriteLine("multiplication of array:");
            for (int i = 0; i < numbers.Length; i++)
            {
                mult *= numbers[i];
            }
            Console.WriteLine(mult);
        }
        
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# azure get vm get cpu usage 
::  
Csharp ::  
:: C# Create Swiss QR-Bill API 
Csharp :: stackoverflow array c# 
Csharp ::  
Csharp ::  
::  
:: startup c# class winform 
Csharp :: AutoMapper Add Assemblies 
Csharp :: C# enum fglag 
Csharp :: mvc validate 
Csharp ::  
Csharp :: ASP.Net MVC 5 datalist event trap to perform action 
Csharp :: c# 2 timespan return yesterday 
Csharp :: Jeng InitDb 
Csharp :: design pattern for so many conditions c# 
Csharp :: runner dotnet trace inside docker container 
:: web socket background.js example 
Csharp :: php encrypt message encrypt() decrypt 
Csharp ::  
::  
Csharp ::  
Csharp :: ef core totable 
:: radio buttons into database stackoverflow 
::  
Csharp :: split string by 5 characters c# 
Csharp ::  
:: boucle C# 
::  
ADD CONTENT
Topic
Content
Source link
Name
2+7 =