ARRAY 1 DIMENSI
Array merupakan suatu variabel tipe data terstruktur yang berguna untuk menyimpan sejumlah data yang bertipe sama. Bagian yang menyusun array disebut elemen array(isi), yang masing-masing elemen dapat diakses tersendiri melalui indeks array. Sebuah subscript berupa bilangan di dalam Kurung siku […]
Contoh Array 1 Dimensi pada bahasa pemograman C#
Output
Source Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SILVIA_RANTI_20312073_IF20B_ARRAY
{
class Program
{
static void Main(string[] args)
{
int JumlahData_20312073;
int x = 1;
Console.Write("MASUKKAN JUMLAH DATA : ");
JumlahData_20312073 = int.Parse(Console.ReadLine());
string[] nama = new string[JumlahData_20312073];
for (int s = 0; s < nama.Length; s++)
{
Console.Write("MASUKKAN DATA KE " + x + " : ");
nama[s] = Console.ReadLine();
x++;
}
Console.WriteLine("\nDATA YANG DIMASUKKAN");
Console.WriteLine("********************");
x = 1;
for (int r = 0; r < nama.Length; r++)
{
Console.WriteLine("NAMA KE " + x + " : " + nama [r]);
x++;
}
Console.ReadLine();
}
}
}