Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Disc
- {
- class Disk
- {
- public static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int r = int.Parse(Console.ReadLine());
- int rowCenter = n / 2,
- colCenter = n / 2;
- for(int col = 0; col < n; col++)
- {
- for(int row = 0; row < n; row++)
- {
- int deltaX = row - rowCenter,
- deltaY = col - colCenter;
- double distanceCenter = Math.Sqrt(deltaX * deltaX + deltaY * deltaY);
- bool inDisc = distanceCenter <= r;
- if(inDisc)
- {
- Console.Write("*");
- }
- else
- {
- Console.Write(".");
- }
- }
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment