Bahasa C++
#include
#include
void main() {
int A[10] = {1,2,3,4,5,6,7,8,9,10};
int n = 10;
cout << "Nilai array asal : ";
for (int i=0; i<n; i++)
cout << "Nilai indeks ke-[" << i << "] adalah " << A << endl;
getch();
}
in jeliot
import jeliot.io.*;
public class array {
public static void main()
{
int[] A = {1,2,3,4,5,6,7,8,9,10};
int n = 10;
System.out.print("Nilai array asal : ");
for (int i =0; i<n; i++)
{
System.out.print("Nilai indeks ke-[");
System.out.print(i);
System.out.print("] adalah ");
System.out.print(A[1]); //karena menunjuk alamat
System.out.print("\n");
}
}
}
Tidak ada komentar:
Posting Komentar