Contoh tampilan hasil program seperti di bawah ini.
Langsung aja ke syntax bro.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Latihan3
{
class Program
{
static void Main(string[] args)
{
int jari2, tinggi;
float vt, vk;
Console.Write("Input besaran Jari-Jari(cm) = ");
jari2 = Convert.ToInt32(Console.ReadLine());
Console.Write("Input besaran Tinggi(cm) = ");
tinggi = Convert.ToInt32(Console.ReadLine());
Console.WriteLine();
vt = (float)jari2 * jari2 * tinggi;
vk = (float)1 / 3 * 22 / 7 * jari2 * jari2 * tinggi;
Console.WriteLine("Volume Tabung = {0} cm3", vt);
Console.WriteLine("Volume kerucut = {0} cm3", vk);
Console.ReadKey();
}
}
}
Langsung aja ke syntax bro.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Latihan3
{
class Program
{
static void Main(string[] args)
{
int jari2, tinggi;
float vt, vk;
Console.Write("Input besaran Jari-Jari(cm) = ");
jari2 = Convert.ToInt32(Console.ReadLine());
Console.Write("Input besaran Tinggi(cm) = ");
tinggi = Convert.ToInt32(Console.ReadLine());
Console.WriteLine();
vt = (float)jari2 * jari2 * tinggi;
vk = (float)1 / 3 * 22 / 7 * jari2 * jari2 * tinggi;
Console.WriteLine("Volume Tabung = {0} cm3", vt);
Console.WriteLine("Volume kerucut = {0} cm3", vk);
Console.ReadKey();
}
}
}
EmoticonEmoticon