stefan1919

Disk

Jul 21st, 2015
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.08 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading;
  6.  
  7. namespace novo2
  8. {
  9.     class Program
  10.     {
  11.         static int a;
  12.         static void Main(string[] args)
  13.         {
  14.             int sizeOfTheField;
  15.             sizeOfTheField = int.Parse(Console.ReadLine());
  16.             int radiusOfTheDisk;
  17.             char point = '.';
  18.             char star = '*';
  19.             int center = sizeOfTheField / 2;
  20.             radiusOfTheDisk = int.Parse(Console.ReadLine());
  21.             for (int j = 0; j < sizeOfTheField; j++)
  22.             {
  23.                 for (int i = 0; i < sizeOfTheField; i++)
  24.             {
  25.                 double distance = Math.Sqrt(Math.Pow(center - i, 2) + Math.Pow(center - j, 2));
  26.                 if (distance <= radiusOfTheDisk)
  27.                 {
  28.                     Console.Write(star);
  29.                 }
  30.                 else
  31.                 {
  32.                     Console.Write(point);
  33.                 }
  34.             }
  35.                 Console.WriteLine();
  36.             }
  37.             }
  38.         }
  39.     }
Advertisement
Add Comment
Please, Sign In to add comment