Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication1
- {
- class Program
- {
- public class konty
- {
- public int a;
- public int b;
- public int c;
- public konty(int bok)
- {
- a = b = c = bok;
- }
- public konty(int _a, int _b, int _c)
- {
- a = _a;
- b = _b;
- c = _c;
- }
- public int obw()
- {
- return a + b + c;
- }
- public double pole()
- {
- int p = this.obw() / 2;
- return Math.Sqrt(p * (p - a) * (p - b) * (p - c));
- }
- }
- static void Main(string[] args)
- {
- konty kont = new konty(5);
- konty prost = new konty(2, 1, 2);
- Console.WriteLine("\nPierwszy = " + kont.obw() + " pole = " + kont.pole());
- Console.WriteLine("Drugi = " + prost.obw() + " pole = " + prost.pole());
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement