C# Online Compiler
Example: How to Find the Perimeter of a Rectangle in C# Program
C
C++
C#
Java
Python
PHP
main.cs
STDIN
Run
// How to Find the Perimeter of a Rectangle in C# Program using System; public class W3CW { static public void Main (string[] args) { Console.WriteLine("Enter the length & width of the rectangle::\n"); float l=Convert.ToInt32(Console.ReadLine()); float w=Convert.ToInt32(Console.ReadLine()); // It will calculate the perimeter of the rectangle float p = 2 * (l + w); // It will print the final output Console.WriteLine("The Perimeter of rectangle = "+p+" units"); } }
9 8
Output
Clear
ADVERTISEMENTS