fbinnzhivko

03.03 Disk

Apr 15th, 2016
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.62 KB | None | 0 0
  1. using System;
  2. class Disks
  3. {
  4.     static void Main()
  5.     {
  6.         int n = int.Parse(Console.ReadLine());
  7.         int r = int.Parse(Console.ReadLine());
  8.         int center = n / 2;
  9.  
  10.         for (int x = 0; x < n; x++)
  11.         {
  12.             for (int y = 0; y < n; y++)
  13.             {
  14.                 if (Math.Sqrt((x - center) * (x - center) + (y - center) * (y - center)) <= r)
  15.                 {
  16.                     Console.Write("*");
  17.                 }
  18.                 else
  19.                 {
  20.                     Console.Write(".");
  21.                 }
  22.  
  23.             }
  24.             Console.WriteLine();
  25.         }
  26.     }
  27. }
Add Comment
Please, Sign In to add comment