Tag: 25.10.16
C# – zajęcia 25-10-2016
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace zajecia2 { class Program { static void Main(string[] args) { int k = 0; for (int i = 1; i <= 100; i++) { k = k + i; //to samo k+=i Console.WriteLine("Wartość k: " + k + "; Krok: " + i); } //do while int x = 11; do { Console.WriteLine(x); x++; } while (x <= 10); //while int i = 1; while (i <= 100) { Console.WriteLine(i); i++; } try { int a = 5; int b = 0; Console.WriteLine(a/b); } catch (DivideByZeroException exc) { Console.WriteLine(exc.Message); } catch (Exception ex) { Console.WriteLine(ex.Message); } int liczba1 = 0; int liczba2; bool isIntType; do { try { Console.WriteLine("Podaj 1 liczbę"); liczba1 = Convert.ToInt16(Console.ReadLine()); isIntType = false; } catch (Exception ex) { Console.WriteLine(ex.Message); isIntType = true; } } while (isIntType); Console.WriteLine("Podałeś liczbę: {0}", liczba1); } } } |
Jerzy KołakowskiPasjonat informatyki, bloger. Full-stack Developer Technologie: ASP.NET MVC ASP.NET CORE Angular 2+
Read More »