CSharp examples for Language Basics:if
Use nested if statement to check the value range
using System;/* w w w. j av a2 s .c o m*/ class BalanceAssessment { public static void Main() { decimal balance; Console.Write("Enter balance: "); balance = Convert.ToDecimal(Console.ReadLine()); if(balance >= 5000) { if(balance <= 20000) { Console.WriteLine("5000 <= balance <= 20000. Level A"); } else { if(balance >= 60000) { if(balance <= 75000) Console.WriteLine("60000 <= balance <= 75000. Level B"); else Console.WriteLine("balance > 75000. Level C"); } else Console.WriteLine("20000 < balance < 60000. Level C"); } } else { Console.WriteLine("balance < 5000. Level C"); } } }