Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Disk
- {
- static void Main()
- {
- decimal n = int.Parse(Console.ReadLine());
- decimal r = int.Parse(Console.ReadLine());
- char[,] board = new char[(int)n,(int)n];
- int x1 = 0;
- int y1 = 0;
- for (int line = 0; line < n; line++)
- {
- for (int row = 0; row < n; row++)
- {
- double x2 = line - (double)Math.Floor(n / 2);
- double y2 = row - (double)Math.Floor(n / 2);
- double pow1 = Math.Pow((x2 - x1), 2);
- double pow2 = Math.Pow((y2 - y1), 2);
- if (pow1 + pow2 <= (int)r * (int)r)
- {
- board[line, row] = '*';
- }
- else
- {
- board[line, row] = '.';
- }
- }
- }
- board[(int)n / 2, (int) n / 2] = '*';
- for (int line = 0; line < n; line++)
- {
- for (int row = 0; row < n; row++)
- {
- Console.Write(board[line, row]);
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement