Skip to content

Instantly share code, notes, and snippets.

@Kiso-blg
Created March 13, 2016 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kiso-blg/4401c2c15dbe98859ac5 to your computer and use it in GitHub Desktop.
Save Kiso-blg/4401c2c15dbe98859ac5 to your computer and use it in GitHub Desktop.
Basics Exam 20 December 2014
using System;
namespace Problem_3___Boat
{
class Boat
{
static void Main(string[] args)
{
int size = int.Parse(Console.ReadLine());
int dots = size - 1;
int asterics = 1;
for (int row = 0; row < size; row++)
{
string rightDots = new string('.', size);
string leftDots = new string('.', dots);
string flag = new string('*', asterics);
Console.WriteLine("{0}{1}{2}", leftDots, flag, rightDots);
dots = (row < size / 2) ? (dots -= 2) : (dots += 2);
asterics = (row < size / 2) ? (asterics += 2) : (asterics -= 2);
}
dots = 0;
asterics = size * 2;
for (int row = 0; row < size / 2; row++)
{
string space = new string('.', dots);
string body = new string('*', asterics);
Console.WriteLine("{0}{1}{0}", space, body);
dots++;
asterics -= 2;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment