Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Saturday 4 March 2017

Formula based program


Formula #7 (Perimeter and area of rhombus)

Enter length of side: 5
Perimeter of rhombus: 20
Area of rhombus: 25

The program for the formula is written in C# programming language and will accept a number as length of side. Based on the formula it will find out the perimeter and area of rhombus.
 
Formula based program

Note: If you are new to C# and Console Application. Try to code First C# Program

Note: Read articles on how to use Loops and Conditions.

Let’s find out a simple and easy way to code these formula.

Practical Implementation:

using System;

namespace patternProblem.Formula
{
    class Formula7     //perimeter and area of rhombus
    {
        static void Main(string[] args)
        {
            Console.Write("Enter length of side: ");
            double sideLength = Convert.ToDouble(Console.ReadLine());
            double area = 0.0, perimeter = 0.0;

            perimeter = 4 * sideLength;
            area = Math.Pow(sideLength, 2);

            Console.WriteLine("Perimeter of rhombus: {0}", perimeter);
            Console.WriteLine("Area of rhombus: {0}", area);

            Console.ReadKey();
        }
    }
}

Output:
The input length of side here is 5. So, based on the rhombus formula. The output is shown below:

Enter length of side: 5
Perimeter of rhombus: 20
Area of rhombus: 25


For any query, comment us below.

Skip to Main Table – Formula based program

Previous – Formula based program #6


Click imagination hunt to read latest blogs.


Keep learning and sharing...

No comments:

Post a Comment

Featured post

Think that makes you rich and richer

 Napolean said: “You can think and grow rich, but if you can be brought up like most people with work and you won't starve, this wil...