In: Computer Science
Write a PowerShell script which will prompt user to enter the number of the day of the week (e.g. 1,2,3,4,5,6,7) and return the day of the week. (e.g. Sunday...etc.) (Hint: Sunday is the 1st day of the week).
Hello, Student I hope you are doing great in lockdown.
Here is PowerShell script which will prompt user to enter the number of the day of the week (e.g. 1,2,3,4,5,6,7) and return the day of the week. (e.g. Sunday...etc.), if still you have any doubt then feel free to ask in comment section, I am always happy to help you.
Please upvote.
Save the program as yourname.ps1 or as PowerShell script and execute.
Function GetInput
{
$Prompt = Read-host "Enter the number of the day of the week:)"
Switch ($Prompt)
{
1 {Write-Host "Sunday"}
2 {Write-Host "Monday"}
3 {Write-Host "Tuesday"}
4 {Write-Host "Wednesday"}
5 {Write-Host "Thursday"}
6 {Write-Host "Friday"}
7 {Write-Host "Saturday"}
Default {GetInput}
}
}
Feel free to ask in comment section if you are facing any issues.
Please do not forget to hit that like or thumbs-up button, it really motivates me<3
Thank you!!
Have a nice day:)