Advertisement
mellowdeep

Disk

Jan 3rd, 2016
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. namespace Disk
  5. {
  6.     class Disk
  7.     {
  8.         static void Main()
  9.         {
  10.             int size = int.Parse(Console.ReadLine());
  11.             int radius = int.Parse(Console.ReadLine());
  12.  
  13.             for (int row = 0; row < size; row++)
  14.             {
  15.                 for (int col = 0; col < size; col++)
  16.                 {
  17.                     Console.Write("{0}", GetPoint(row, col, radius,size) ? '*' : '.');
  18.                 }
  19.                 Console.WriteLine();
  20.             }
  21.         }
  22.  
  23.         private static bool GetPoint(int row, int col, int radius,int size)
  24.         {
  25.             int pythagorean = (int)(Math.Pow(row - size/2, 2) + Math.Pow(col - size/2, 2));
  26.  
  27.             return pythagorean <= (int)Math.Pow(radius, 2) ? true : false;
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement