Posts

Calculate Area of Different Shapes in C# Using Method.

 CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CP_Methods_paractise {     class Program     {         public static void circle(double rad)         {             double area = Math.PI * Math.Pow(rad, 2);             Console.WriteLine("The Area Of Circle Is:{0}",area);         }         public static void Square(double Len)         {             double area = Math.Pow(Len, 2);             Console.WriteLine("The Area Of Square Is:{0}", area);         }         public static void Rectangle(double reclen,double wid)         {             double area = reclen * wid;             Console.WriteLine("The Area Of Rectangle Is:{0}", area);         }         public static void Tringle(double tribas,double trihei)         {             double area = 0.5*(tribas * trihei);             Console.WriteLine("The Area Of Triangle Is:{0}", area);         }         static void Main(s

Calculator in c# using Method void method

 CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CP_Methods_paractise {     class Program     {         public  void addition(double num1, double num2)         {             double result = num1 + num2;             Console.WriteLine("Addition of Numbers:{0}",result);         }         public  void Substruction(double num1, double num2)         {             double result = num1 - num2;             Console.WriteLine("Substruction of Numbers:{0}", result);         }         public  void Multiplication(double num1, double num2)         {             double result = num1 * num2;             Console.WriteLine("Multiplication of Numbers:{0}", result);         }         public  void Division(double num1, double num2)         {             double result = num1 / num2;             Console.WriteLine("Division of Numbers:{0}", result);         }         static void Main(stri

Calculator in c# using Static Methods

 CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CP_Methods_paractise {     class Program     {         public static void addition(double num1, double num2)         {             double result = num1 + num2;             Console.WriteLine("Addition of Numbers:{0}",result);         }         public static void Substruction(double num1, double num2)         {             double result = num1 - num2;             Console.WriteLine("Substruction of Numbers:{0}", result);         }         public static void Multiplication(double num1, double num2)         {             double result = num1 * num2;             Console.WriteLine("Multiplication of Numbers:{0}", result);         }         public static void Division(double num1, double num2)         {             double result = num1 / num2;             Console.WriteLine("Division of Numbers:{0}", result);         }      

Calculator in c# using Methods static method using return method

 CODE: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CP_Methods_paractise {     class Program     {         public static double addition(double num1, double num2)         {             double result = num1 + num2;             return result;         }         public static double Substraction(double num1, double num2)         {             double result = num1 - num2;             return result;         }         public static double Multiplication(double num1, double num2)         {             double result = num1 * num2;             return result;         }         public static double Devision(double num1, double num2)         {             double result = num1 / num2;             return result;         }         static void Main(string[] args)         {             Console.WriteLine("Enter First Number:");             double a = Convert.ToDouble(Console.ReadLine());             Console.WriteLi

Calculate Average Marks And Performance on the basis of marks in c#.

 CODE: Console.WriteLine("Enter No Of Students");             int nos = Convert.ToInt32(Console.ReadLine());                       string[,] array1 = new string[nos, 8];             for (int i = 0; i < nos; i++)             {                 Console.WriteLine("Enter name of student:{0}",i+1);                 array1[i, 0] = Console.ReadLine();                 Console.WriteLine("Enter Marks Of Physics for student:{0}",i+1);                 array1[i, 1] = Console.ReadLine();                 Console.WriteLine("Enter Marks Of Chemistry for student:{0}", i + 1);                 array1[i, 2] = Console.ReadLine();                 Console.WriteLine("Enter Marks Of Maths for student:{0}", i + 1);                 array1[i, 3] = Console.ReadLine();             }             for (int i = 0; i < nos; i++)             {                 int physics = Convert.ToInt32(array1[i,1]);                 int chemistry = Convert.ToInt32(array1[i, 2]);    

FIND Nationality and his/her eyecolor in 2d array in c#.

 Take N number of user data input and make sure N is greater then 10, which contain name of the user, his/her nationality and his/her eye color. You have to show the max color of eye in each country. CODE:             DateTime dt = DateTime.Now;             Console.WriteLine("{0}", dt);             Console.WriteLine("Number Of Records ");             int n = Convert.ToInt32(Console.ReadLine());             if (n <= 5)             {                 Console.WriteLine("Please enter more than 10 records.");                 return;             }             String[,] data = new string[n, 3];             for (int i = 0; i < data.GetLength(0); i++)             {                 Console.WriteLine("Enter Data for Person {0}", i + 1);                 for (int j = 0; j < 1; j++)                 {                     Console.WriteLine("Name");                     data[i, 0] = Console.ReadLine().ToLower();                     Console.Write

Make a program in C# in which take no. of items, price of items, quantity of items and name of items (Use 2D Array):

 Make a program in C# in which take no. of items, price of items, quantity of items and name of items as input from the user and give the discount according to the following conditions (Use 2D Array):  a. If from Bahria University give discount of 30%.  b. Else if the total amount is greater than 50,000 and less than 100,000 give discount of 20%.  c. Else if the total amount is greater than 100,000 give discount of 30%. CODE:    Console.WriteLine("Number of items do you want to add");             int add = Convert.ToInt32(Console.ReadLine());             string[,] array1 = new string[add, 3];             for (int i = 0; i < add; i++)             {                 Console.WriteLine("\t\tEnter Detail Of Product:{0}", i + 1);                 Console.WriteLine("Enter Product name:");                 array1[i, 0] = Console.ReadLine();                 Console.WriteLine("Enter Product Quantity:");                 array1[i, 1] = Console.ReadLine();