Q:

Write a program in C# Sharp to display the name of the days of a week

0

Write a program in C# Sharp to display the name of the days of a week.

Expected Output:
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text; 
class LinqExercise6
    {
        static void Main(string[] args)
        {
            string[] dayWeek = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };	
            Console.Write("\nLINQ : Display the name of the days of a week : "); 
            Console.Write("\n------------------------------------------------\n");					
            var days = from WeekDay in dayWeek 
			           select WeekDay;
            foreach (var WeekDay in days)
            {
                Console.WriteLine(WeekDay);
            }
            Console.WriteLine();
        }
    }

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now