@nakov/

size-checker-if-else-csharp

C#

Check rectangle size with if-else statements in C#

fork
loading
Files
  • main.cs
  • main.exe

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.48680148248378585","path":"main.cs","file":{"path":"main.cs","content":{"asEncoding":{"base64":"dXNpbmcgU3lzdGVtOwoKY2xhc3MgU2l6ZUNoZWNrZXIgewogICAgcHVibGljIHN0YXRpYyB2b2lkIE1haW4oKSB7CiAgICAgICAgdmFyIHNpemUgPSBkZWNpbWFsLlBhcnNlKENvbnNvbGUuUmVhZExpbmUoKSk7CiAgICAgICAgaWYgKHNpemUgPCAwKQogICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgkIk5lZ2F0aXZlIHNpemU6IHtzaXplfSIpOwogICAgICAgIGVsc2UgaWYgKHNpemUgPiAxMDAwKQogICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZSgkIlNpemUgdG9vIGJpZzoge3NpemV9Iik7CiAgICAgICAgZWxzZQogICAgICAgIHsKICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoJCJTaXplIGFjY2VwdGVkOiB7c2l6ZX0iKTsKICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoJCJBcmVhOiB7c2l6ZSAqIHNpemV9Iik7CiAgICAgICAgfQogICAgfQp9"},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
using System;

class SizeChecker {
    public static void Main() {
        var size = decimal.Parse(Console.ReadLine());
        if (size < 0)
            Console.WriteLine($"Negative size: {size}");
        else if (size > 1000)
            Console.WriteLine($"Size too big: {size}");
        else
        {
            Console.WriteLine($"Size accepted: {size}");
            Console.WriteLine($"Area: {size * size}");
        }
    }
}