Advertisement
BojidarDosev

Zadacha 1 Class

Apr 18th, 2021
845
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.39 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp3
  4. {
  5.     class Program
  6.     {
  7.         class Rectan
  8.         {
  9.             private int a, b;
  10.             public Rectan (int a1, int b1)
  11.             {
  12.                 a = a1; b = b1;
  13.             }
  14.             public void Rectan1()
  15.             {
  16.                 a = 0; b = 0;
  17.             }
  18.             public int Rectan2
  19.             {
  20.                 set
  21.                 {
  22.                     a = value;b = value;
  23.                 }
  24.             }
  25.             public int Area
  26.             {
  27.                 get
  28.                 {
  29.                     return  a * b;
  30.                 }
  31.             }
  32.         }
  33.         static void Main(string[] args)
  34.         {
  35.             Rectan R1 = new Rectan(3,5);
  36.             int k = int.Parse(Console.ReadLine());
  37.             int k1 = int.Parse(Console.ReadLine());
  38.             Rectan R2 = new Rectan(k, k1);
  39.             Rectan R3 = new Rectan(4, 6);
  40.             Console.WriteLine("S1 = " + R1.Area);
  41.             Console.WriteLine("S2 = " + R2.Area);
  42.             Console.WriteLine("S3 = " + R3.Area);
  43.             int S1 = R1.Area;
  44.             int S2 = R2.Area;
  45.             int S3 = R3.Area;
  46.             if (S1 > S2 && S1 > S3) Console.WriteLine("Max Area is: " + S1);
  47.             else if (S2 > S3) Console.WriteLine("Max Area is: " + S2);
  48.             else Console.WriteLine("Max Area is: " + S3);
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement