Posts

Check Total Days in Month and The Year Is Leap or Not in c# using Switch-Case.

  CODE:  Console.WriteLine("Enter Year:");             int year = Convert.ToInt32(Console.ReadLine());             Console.WriteLine("Enter Month Which Do You Want To Check:");             int month = Convert.ToInt32(Console.ReadLine());             switch (month)             {                 case 1:                     Console.WriteLine("The Month is January Total days in this month is 31");                     break;                 case 2:                     if ((year%4==0 && year%100 !=0)||year%400==0)                     {     ...

Bahria Payment system give discount to selected student in c#. using switch case

 CODE: using System; public class HelloWorld {     public static void Main(string[] args)     {                      Console.WriteLine("\t\"Welcome To Bahria University Payment System\"");             Console.WriteLine("Enter Your Total Fees:");             double fees = double.Parse(Console.ReadLine());             Console.WriteLine("\nSelect Catagory in Which You Belong");             Console.WriteLine("1.Naval Background");             Console.WriteLine("2.Armed Force");             Console.WriteLine("3.Sibling");             Console.WriteLine("4.Orther Students");                        double choose = double.Parse(Console.ReadLine()); ...

Calculate Area of Circle , Rectangle, Triangle, square in switch-case in c#.

 CODE:   using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Switch_Case_practise {     class Program     {         static void Main(string[] args)         {             double area=0;             Console.WriteLine("Choose Shape To Calculate It Area:");             Console.WriteLine("1.Circle");             Console.WriteLine("2.Square");             Console.WriteLine("3.Ractangle");             Console.WriteLine("4.Triangle");             int choise = int.Parse(Console.ReadLine());             switch (choise)             {                 ca...

Repeatedly print the value of the variable xValue, decreasing it by 0.5 each time, as long as xValue remains positive in c#.

 CODE: using System; public class HelloWorld {     public static void Main(string[] args)     {         double xValue;               Console.WriteLine("Enter xValue Which you want to Check:");               xValue = Convert.ToDouble(Console.ReadLine());               for (; xValue > 0; xValue -= 0.5)               {                   Console.WriteLine("The xValue:{0}",xValue);               }               Console.WriteLine("The xValue is no longer Positive ");      } }

Make a game in C#, in which give 5 tries to the user to guess the value of the number.

 CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace For_Loop_lab6 {     class Program     {         static void Main(string[] args)         {             DateTime dt = DateTime.Now;             Console.WriteLine("{0}", dt);              int secnum = 10;             int tries = 5;             int usetries = 0;             for (int i = 1; i <=tries; i++)             {                 Console.WriteLine("Enter Guessed Number:");                 int gesnum = Convert.ToInt32(Console.ReadLine());                 usetri...

Print Star Pattern in c# . for Loop.

Image
 

Print the square roots of the first 25 odd positive integers. IN C#

Image
  Print the square roots of the first 25 CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;   namespace For_Loop_lab6 {     class Program     {        static void Main( string [] args)         {        DateTime dt = DateTime.Now;             Console.WriteLine( "{0}" ,dt);            int n = 25;             double result,odd;             for ( int i = 1; i <=25; i++)             {                 odd =...