Question #273674

1. The side of the square is given. Find the perimeter.

Expert's answer

using System;

namespace Test
{
    class PerimeterTest
    {
        static int Main()
        {
            int side;

            Console.Write("Enter the side of the square: ");
            string line = Console.ReadLine();

            if(!int.TryParse(line, out side))
            {
                Console.WriteLine("Bad input");
                return 1;
            }

            Console.WriteLine("The perimeter is {0}", 4 * side);

            return 0;
        }
    }
}
LATEST TUTORIALS
APPROVED BY CLIENTS