//UBAH AJAH VARIABELNYA AMA KALIAN OKOK!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ratingdanfrekuensi_take_home_quis_
{
class Program
{
static void Main(string[] args)
{
int[] bil = new int[20];
int count1 = 0;
int count2 = 0;
int count3 = 0;
int count4 = 0;
int count5 = 0;
string output = "";
Console.WriteLine("Masukan 20 angka dari 1-5");
for (int i = 0; i < bil.Length; i++)
{
Console.Write("Masukan angka ke-{0}:", i + 1);
bil[i] = Convert.ToInt32(Console.ReadLine());
if (bil[i] == 1)
{
count1 = count1 + 1;
}
if (bil[i] == 2)
{
count2 = count2 + 1;
}
if (bil[i] == 3)
{
count3 = count3 + 1;
}
if (bil[i] == 4)
{
count4 = count4 + 1;
}
if (bil[i] == 5)
{
count5 = count5 + 1;
}
output = output + bil[i] + " ";
}
Console.Clear();
Console.WriteLine("Yang anda inputkan : \n {0} \n", output);
Console.WriteLine("{0}{1,10} ", "rating", "frekuensi");
Console.WriteLine(" 1 {0}", count1);
Console.WriteLine(" 2 {0}", count2);
Console.WriteLine(" 3 {0}", count3);
Console.WriteLine(" 4 {0}", count4);
Console.WriteLine(" 5 {0}", count5);
Console.ReadLine();
}
}
}
2 komentar:
keren,,, lanjutkan!
mqin lngkap ni....
^__^
keren ka....
Posting Komentar