Conditional Constructs
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
namespace CSharp_Shell
{
public class Program
{
public static void Main()
{
/*
//Display Corresponding Days
int input;
//
start:
Console.Write("Enter a number : ");
input = int.Parse(Console.ReadLine());
//
switch (input)
{
case 1:
Console.WriteLine("Monday");
break;
case 2:
Console.WriteLine("Tuesday");
break;
case 3:
Console.WriteLine("Wednesday");
break;
case 4:
Console.WriteLine("Thursday");
break;
case 5:
Console.WriteLine("Friday");
break;
case 6:
Console.WriteLine("Saturday");
break;
case 7:
Console.WriteLine("Sunday");
break;
default:
Console.WriteLine("Enter a number 1-7\n");
goto start;
break;
}
*/
/*
//Calculate Tax
float money, tax;
//
Console.Write("Enter money : ");
money = float.Parse(Console.ReadLine());
//
if (money < 10000)
{
tax = 0.05f * money;
}
else if (money >= 10000 && money < 100000)
{
tax = 0.08f * money;
}
else
{
tax = 0.085f * money;
}
//
Console.WriteLine("Tax = {0}", tax);
*/
/*
//Library Management
char input;
//
Console.WriteLine("c:for computer books");
Console.WriteLine("m:for math books");
Console.WriteLine("h:for history books");
Console.WriteLine("e:for english books");
start:
input = char.Parse(Console.ReadLine());
//
switch (input)
{
case 'c':
Console.WriteLine("Computer Books");
break;
case 'm':
Console.WriteLine("Math Books");
break;
case 'h':
Console.WriteLine("History Books");
break;
case 'e':
Console.WriteLine("English Books");
break;
default:
Console.WriteLine("Try again");
goto start;
break;
}
*/
}
}
}
Comments
Post a Comment