pupesko

SoftUni - 4.3 Circle Perimeter and Area

Sep 30th, 2015
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3.  
  4. class CircleAreaRadius
  5. {
  6.     static void Main()
  7.     {
  8.     //Write a program that reads the radius r of a circle and prints its perimeter and area formatted with 2 digits after the decimal point.
  9.    
  10.         Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
  11.  
  12.         Console.Write("Enter r (radius) of a circle: ");
  13.         double r = double.Parse(Console.ReadLine());
  14.        
  15.         Console.WriteLine("The circle Perimeter is: {0:N2}", 2 * Math.PI * r);
  16.         Console.WriteLine("The cirlce Area is: {0:N2}", Math.PI * r * r);
  17.            
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment