using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace
ConsoleApplication3
{
class Program
{
static void Main(string[]
args)
{
Menu :
int
pil;
Console.WriteLine("Menu Hitung Bangun Datar");
Console.WriteLine("1. Luas & Keliling Persegi Panjang");
Console.WriteLine("2. Luas & Keliling Persegi");
Console.WriteLine("3. Luas & Keliling Lingkaran");
Console.WriteLine("4. Keluar Program");
Console.WriteLine("Masukkan Pilihan Menu Anda [1,2,3,4]: ");
string
input;
input = Console.ReadLine();
int.TryParse(input,
out pil);
Console.Clear();
switch
(pil)
{
case
1: Console.WriteLine("1. Luas & Keliling Persegi Panjang");
int
pjng, lbar, luas, keliling;
Console.Write("masukan panjang : ");
pjng = int.Parse(Console.ReadLine());
Console.Write("masukan lebar : ");
lbar = int.Parse(Console.ReadLine());
luas = pjng * lbar;
keliling = 2*(pjng + lbar);
Console.WriteLine("luas = "+luas);
Console.WriteLine("keliling = "+keliling);
Console.ReadLine();
Console.Clear();
goto
Menu;
break;
case
2: Console.WriteLine("2. Luas & Keliling Persegi");
int
sisi, luas1, keliling1;
Console.Write("masukan sisi : ");
sisi = int.Parse(Console.ReadLine());
luas1 = sisi*sisi;
keliling1 = 4*sisi;
Console.WriteLine("luas1 = " + luas1);
Console.WriteLine("keliling1 = " + keliling1);
Console.ReadLine();
Console.Clear();
goto
Menu;
break;
case
3: Console.WriteLine("3. Luas & Keliling Lingkaran");
double
ph=3.14 ,d,r, luas2, keliling2;
Console.Write("masukan d : ");
d = int.Parse(Console.ReadLine());
Console.Write("masukan r : ");
r = int.Parse(Console.ReadLine());
luas2 = ph*r*r;
keliling2 = 4*ph*d;
Console.WriteLine("luas2 = " + luas2);
Console.WriteLine("keliling2 = " + keliling2);
Console.ReadLine();
Console.Clear();
goto
Menu;
break;
Console.ReadLine();
Console.Clear();
goto
Menu;
break;
}
}
}
}
Download script disini
No comments:
Post a Comment