Created
October 27, 2019 22:31
-
-
Save lion137/11a6e52a2ae81bf8e169426d0bb00bc5 to your computer and use it in GitHub Desktop.
Some lecture on C# basis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ConsoleApp5 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
/* const int num = 42; | |
Console.WriteLine($"My number is {num}"); | |
int num1 = 33; | |
int num2 = 10; | |
Console.WriteLine($"Outcome of num1 % num2 = {num1 % num2}"); | |
Console.WriteLine($"Outcome of num1 / num2 = {10 / 4.0f}"); | |
Console.ReadLine(); | |
float a; | |
float b; | |
float h; | |
Console.WriteLine("Podaj a, b, i h trapezu"); | |
a = float.Parse(Console.ReadLine()); | |
b = float.Parse(Console.ReadLine()); | |
h = float.Parse(Console.ReadLine()); | |
float p = 0.5f * h * (a + b); | |
Console.WriteLine($"Pole trapezu wynosi {p} "); | |
double PI = Math.PI; | |
Console.WriteLine("Podaj promien kola"); | |
float r; | |
r = float.Parse(Console.ReadLine()); | |
double pole = PI * r * r; | |
Console.WriteLine($"Pole kola wynosi {pole}"); | |
float var = 4 / 5f; // Wazne! | |
Console.WriteLine($"float var = {var}"); | |
try | |
{ | |
double PI = Math.PI; | |
Console.WriteLine("Podaj promien kola"); | |
float r; | |
r = float.Parse(Console.ReadLine()); | |
double pole = PI * r * r; | |
Console.WriteLine($"Pole kola wynosi {pole}"); | |
} | |
catch (System.FormatException e) | |
{ | |
Console.WriteLine("promien ma byc liczba, bye"); | |
} | |
try | |
{ | |
// 0 Celsjusza to 32 Fahrenheit | |
// F = (9 * C) / 5 + 32 | |
// C = 5 * (F - 32) / 9 | |
Console.WriteLine("Program do przeliczania F na C"); | |
Console.WriteLine("Podaj temperature w stopniach F"); | |
float farnh = float.Parse(Console.ReadLine()); | |
float cels = 5 * (farnh - 32) / 9; | |
Console.WriteLine($"Temp w Celsjuszach = {cels}"); | |
} | |
catch (System.FormatException e) | |
{ | |
Console.WriteLine(e.ToString()); // Polecane toString | |
}*/ | |
// Objetosc Kuli, uzyc Math.Pow(), try, catch homework | |
string str1 = "Hello "; | |
string str2 = "Word"; | |
int intVar1 = 1; | |
int intVar2 = intVar1 = 42; | |
Console.WriteLine($"{intVar2}"); | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment