Sunteți pe pagina 1din 8

using using using using

System; System.Collections.Generic; System.Linq; System.Text;

namespace ConsoleApplication6 { class Program { static void Main(string[] args) { Console.WriteLine("what do you want to do??for addition press 1,for substraction press 2,for multiplication press 3,for division press 4"); int listen = int.Parse(Console.ReadLine()); if (listen == 1) { Console.WriteLine("Enter first number"); int first=int.Parse(Console.ReadLine()); Console.WriteLine("Enter secound number"); int secound=int.Parse(Console.ReadLine()); int result1=arg1(first,secound); Console.WriteLine("result"+result1); } if (listen == 2) { Console.WriteLine("Enter first number"); int first = int.Parse(Console.ReadLine()); Console.WriteLine("Enter secound number"); int secound = int.Parse(Console.ReadLine()); int result = arg2(first, secound); Console.WriteLine("result" + result); } if (listen == 3) { Console.WriteLine("Enter first number"); int first = int.Parse(Console.ReadLine()); Console.WriteLine("Enter secound number"); int secound = int.Parse(Console.ReadLine()); int result = arg3(first, secound); Console.WriteLine("result" + result); } if (listen == 4) { Console.WriteLine("Enter first number"); int first = int.Parse(Console.ReadLine()); Console.WriteLine("Enter secound number"); int secound = int.Parse(Console.ReadLine()); int result = arg4(first, secound); Console.WriteLine("result" + result); } Console.ReadLine(); } static int arg1(int first,int secound) { return (first + secound); } static int arg2(int first, int secound) { if(first>secound) return(first-secound); else

return(secound-first); } static int arg3(int first, int secound) { return(first*secound); } static int arg4(int first, int secound) { if (first > secound) return (first / secound); else return(secound/first); } } }

namespace ConsoleApplication7 { class Program { static void Main(string[] args) { Console.WriteLine("enter three numbers"); Console.WriteLine("enter first number"); int first = int.Parse(Console.ReadLine()); Console.WriteLine("enter secound number"); int secound = int.Parse(Console.ReadLine()); Console.WriteLine("enter third number"); int third = int.Parse(Console.ReadLine()); if (first > secound && first > third)

{ int result = output(first); Console.WriteLine("the largest among the numbers is::"+first); } if (secound > first && secound > third) { int result = output2(secound); Console.WriteLine("the largest among the numbers is::" + secound ); } if (third > first && third > secound) { int result = output3(third); Console.WriteLine("the largest among the numbers is::" + third); } Console.ReadLine(); } static int { return } static int { return } static int { return } } } output(int first) (first); output2(int secound) (secound); output3(int third) (third);

using using using using

System; System.Collections.Generic; System.Linq; System.Text;

namespace ConsoleApplication8 { class Program { static void Main(string[] args) {

Console.WriteLine("enter the interest rate"); double rateofinterest = double.Parse(Console.ReadLine()); double result = calculateinterest(rateofinterest); Console.WriteLine("total interest is " + result); Console.ReadLine(); } static double calculateinterest(double rateofinterest) { Console.WriteLine("enter the capital"); double capital = double.Parse(Console.ReadLine()); Console.WriteLine("enter the year"); double year = double.Parse(Console.ReadLine()); return(capital*year*rateofinterest/100); } } }

using using using using

System; System.Collections.Generic; System.Linq; System.Text;

namespace ConsoleApplication9

{ class Program { static void Main(string[] args) { Console.WriteLine("enter the interest rate"); double rateofinterest = double.Parse(Console.ReadLine()); Console.WriteLine("please enter your age"); double age = double.Parse(Console.ReadLine()); if (age > 60) { rateofinterest = rateofinterest - 25; } else if (age < 25) { rateofinterest = rateofinterest - 10; } double result = calculateinterest(rateofinterest); Console.WriteLine("total interest is " + result); Console.ReadLine(); } static double calculateinterest(double rateofinterest) { Console.WriteLine("enter the capital"); double capital = double.Parse(Console.ReadLine()); Console.WriteLine("enter the year"); double year = double.Parse(Console.ReadLine());

return (capital * year * rateofinterest / 100); } } }

using using using using

System; System.Collections.Generic; System.Linq; System.Text;

namespace ConsoleApplication10 { class Program { static void Main(string[] args) { Console.WriteLine("enter your marks for 3 subjects please"); Console.WriteLine("enter marks for first subject"); double firstmark = double.Parse(Console.ReadLine()); Console.WriteLine("enter marks for secound subject"); double secoundmark = double.Parse(Console.ReadLine()); Console.WriteLine("enter marks for your third subject"); double thirdmark = double.Parse(Console.ReadLine()); double avaragemark = (firstmark + secoundmark + thirdmark)/3; if (avaragemark >= 80 ) { Console.WriteLine("wow first division"); } else if (avaragemark > 59 && avaragemark < 80) { Console.WriteLine("hum secound division"); } else if (avaragemark > 49 && avaragemark < 60) { Console.WriteLine("third division"); } else if(avaragemark < 50) { Console.WriteLine("fail"); } }

} }

using using using using

System; System.Collections.Generic; System.Linq; System.Text;

namespace ConsoleApplication11 { class Program { static void Main(string[] args) { Console.WriteLine("enter a name"); string s = Console.ReadLine(); if ((s.Length) >= 7) Console.WriteLine("it is lengthy name"); else Console.WriteLine("it is short name"); Console.ReadLine(); } } }

S-ar putea să vă placă și