Script:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VolumeBendaRuang
{
class Program
{
static void Main(string[] args)
{
z:
Console.WriteLine("-------------------------------------------------------------------");
Console.WriteLine("\nProgram Volume");
Console.Write("1. Volume Balok\n2. Volume Kubus\n3. Volume Kerucut\n4. Biodata Anda\n\n");
Console.Write("-----> Masukan Pilihan: ");
int a = Convert.ToInt16(Console.ReadLine());
switch (a)
{
case 1:
Console.WriteLine("\nProgram Volume Balok");
Console.Write("\nMasukan Panjang Balok: ");
float p = Convert.ToInt16(Console.ReadLine());
Console.Write("\nMasukan Lebar Balok: ");
float l = Convert.ToInt16(Console.ReadLine());
Console.Write("\nMasukan Tinggi Balok: ");
float t = Convert.ToInt16(Console.ReadLine());
float vb = p * l * t;
Console.Write("Volume Balok: {0}",vb);
Console.ReadLine();
goto z;
case 2:
Console.WriteLine("\nProgram Volume Kubus");
Console.Write("\nMasukan Sisi: ");
float s = Convert.ToSingle(Console.ReadLine());
float vk = s*s*s;
Console.Write("Volume Kubus: {0}",vk);
Console.ReadLine();
goto z;
case 3:
Console.WriteLine("\nProgram Volume Kerucut");
float phi = 3.14f;
Console.Write("Masukan Jari-Jari Kerucut: ");
float r = Convert.ToSingle(Console.ReadLine());
Console.Write("Masukan Tinggi Kerucut: ");
float tk = Convert.ToSingle(Console.ReadLine());
float vkr = phi*tk*r;
Console.Write("Volume Kerucut: {0}",vkr);
Console.ReadLine();
goto z;
case 4:
Console.WriteLine("\nBiodata Anda");
Console.WriteLine("\n-------------");
string nama, kelas, sekolah, hobby, agama;
Console.Write("Masukan Nama Anda\t: ");
nama = Console.ReadLine();
Console.Write("Masukan Kelas Anda\t: ");
kelas = Console.ReadLine();
Console.Write("Masukan Sekolah Anda\t: ");
sekolah = Console.ReadLine();
Console.Write("Masukan Hobby Anda\t: ");
hobby = Console.ReadLine();
Console.Write("Masukan Agama Anda\t: ");
agama = Console.ReadLine();
Console.WriteLine("\nNama\t\t= {0} \nKelas\t\t= {1} \nSekolah\t\t= {2} \nHobby\t\t= {3} \nAgama\t\t= {4}", nama, kelas, sekolah, hobby, agama);
goto z;
}
}
}
}
Output: