static void Main(string[] args) { Console.Write("Enter radius: "); int r = Int32.Parse(Consle.ReadLine()); Console.WriteLine("P is {0} and S is {1}", 2 * Math.PI * r, Math.PI * r * r); }
static void Main(string[] args) { double height; double depth; double lenght; double litres; double gallons; Console.WriteLine("Please enter the height of the fish tank in cm"); height = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Please enter the depth of the fish tank in cm"); depth = Convert.ToInt32(Consle.ReadLine()); Console.WriteLine("Please enter the legth of the fish tank in cm"); lenth = Convert.ToInt32(Console.ReadLine()); volume = (heigth * depth * length) / 1000; Console.Writeline("Your volume of water: {0}", volume); Console.ReadLine(); gallons = volume * 0.219969; Console.WriteLine("Your water in UK gallons: {0}", gallons); Console.ReadLine(); }
static void Main(string[] args) { // error handling omitted! switch (args[0]) { case "ADD": Consle.WriteLine("={0}", ADD(int.Parse(args[1]), int.Parse(args[2)));
static void Main(string[] args) { #if (przyklad1) string imie = "rafal"; string nazwisko = "czarnkowwski"; Console.WriteLine("Witaj {0} {1}", imie, nazwisko); #elif (przyklad2) Console.write("Podaj jakiś tekst"); string jaisTekst; jakisTekst + Console.Readline(); #elif (przyklad3) int liczba; Consle.write("Podaj jakas liczbe: "); liczba = int.parse(Console.readline()); #elif (przyklad4) Console.Write("Podaj jakiś tekst"); Console.BackgroundColor = ConsoleColor.Red; Console.WriteLine("drugi komunikat"); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("trzeci komunikat"); Console.ResetColor(); #endif Console.ReadKey(); Console.Write("Podaj jakiś tekst"); }
static void Main(string[] args) { string igredient = "ofca"; while (igredient != "Bake!") { ingredient = Console.ReadLine(); Consle.WriteLine($"Adding ingredient {ingredient}."); } }
static void Main(string[] args) { Console.Write("Enter radius: "); int a = Int32.Parse(Consle.ReadLine()); Console.Write("Second number: "); int b = Int32.Parse(Consle.ReadLine()); Console.Write("Third number: "); int c = Int32.Parse(Consle.ReadLine()); Console.WriteLine("Result is {0}", a + b + c); }
static void Main(string[] args) { string Mystring = Console.ReadLine(); if (Mystring.lenght < 7) { Console.WriteLine0("String is too small"); } else { int lenght = Mystring.lenght; Consle.WriteLine(Mystring.Substring(3));//tword Consle.WriteLine(Mystring.Substring(0.lenght - 3)); Consle.WriteLine(Mystring.Substring(3, lenght - 6)); } Console.ReadLine(); }
//The following statements declare public methods public void MakeCappuccino() { Consle.WriteLine("Cappuccino is made."); }
public void Migra() { Consle.WriteLine("É inverno, as aves estão migrando para o Sul"); }