Answer to Question #20140 in C# for kumar saurav

Question #20140
write a program to enter a number from 1 to 7 and display the corresponding day of the week.
1
Expert's answer
2012-12-05T07:05:54-0500
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
class Program
{
& static void Main(string[] args)
& {
Console.WriteLine("Enter a number please: ");
String num = Console.ReadLine();
if (num.Equals("1")) {
& Console.WriteLine("Monday");
}
else if (num.Equals("2"))
{
& Console.WriteLine("Tuesday");
}
else if (num.Equals("3"))
{
& Console.WriteLine("Wednesday");
}
else if (num.Equals("4"))
{
& Console.WriteLine("Thursday");
}
else if (num.Equals("5"))
{
& Console.WriteLine("Friday");
}
else if (num.Equals("6"))
{
& Console.WriteLine("Saturday");
}
else if (num.Equals("7"))
{
& Console.WriteLine("Sunday");
}
Console.ReadLine();
& }
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS