Advertisement
MoNoLidThZ

Untitled

Jul 8th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.12 KB | None | 0 0
  1.  
  2.         static void Main(string[] args) {
  3.  
  4.             float PI = 3.14f;
  5.             float r;
  6.             Console.Write("Put 1 to Calcuate the Length of the Circle \n");
  7.             Console.Write("Put 2 to Calcuate the Area of the Circle \n");
  8.             Console.Write("you put :");
  9.             string x = Console.ReadLine();
  10.             switch (x) {
  11.                 case "1":
  12.                     Console.Write("put radius:");
  13.                     r = int.Parse(Console.ReadLine());
  14.                     float L = (float)2 * PI * r;
  15.                     Console.Write("Lenght of circle is :{0:f}\n", L);
  16.                     break;
  17.                 case "2":
  18.                     Console.Write("put radius:");
  19.                     r = int.Parse(Console.ReadLine());
  20.                     float A = (float)PI * (r * r);
  21.                     Console.Write("Area of circle is : {0}\n", A);
  22.                     break;
  23.                 default:
  24.                     Console.Write("Error\n");
  25.                     break;
  26.             }
  27.             Console.Write("Press any key to continue");
  28.             Console.ReadKey();
  29.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement