Tuesday, 1 May 2018

Simple console application using ForEach Array Condition

Simple console application using ForEach Array Condition
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplicationSample
{
    class ForeachArrayFact
    {
        public static void Main()
        {
            int fact = 1;
            int[] nums = new int[5];
            for (int i = 1; i <=5; i++)
            {
                nums[i] = i;
            }
            foreach (int x in nums)
            {
                //int x = 1;
                Console.WriteLine("Number is...>" + x);
                Console.ReadLine();
                fact = fact * x;
            }
            Console.WriteLine("Factorial = " + fact);
            Console.ReadKey();
        }
    }
}
https://www.youtube.com/channel/UCKLRUr6U5OFeu7FLOpQ-FSw/videos

0 comments

Post a Comment