• This is default featured slide 1 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

  • This is default featured slide 2 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

  • This is default featured slide 3 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

  • This is default featured slide 4 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

  • This is default featured slide 5 title

    Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

1. Terminal Linux



 2. Program Perulangan




Share:

Contoh Perulangan ArrayDi terminal Linux


1. Pertama tama yang harus kita lakukan adalah membuka terminal linux

2. Lalu, Berikutnya kita akan buat suatu file nama bebas dengan ext .sh
 
     #touch array.sh

3. Setelah perintah membuat file sudah,, berikutnya kita akan membuka file      tersebut dengan perintah

     #nano array.sh

    Maka akan tampil tampilan kosong

4. Sudah masuk kedalam file maka kita akan mulai koding nya

     # !/bin/bash
# To input array at run
# time by using while-loop

# echo -n is used to print
# message without new line
echo -n "Enter the Total numbers :"
read n
echo "Enter numbers :"
i=0

# Read upto the size of
# given array starting from
# index, i=0
while [ $i -lt $n ]
do
    # To input from user
    read a[$i]

    # Increment the i = i + 1
    i=`expr $i + 1`
done

# To print array values
# starting from index, i=0
echo "Output :"
i=0

while [ $i -lt $n ]
do
    echo ${a[$i]}

    # To increment index
    # by 1, i=i+1
    i=`expr $i + 1`
done

   Setelah Kodingan selesai maka save dengan perintah ctrl+x, y, enter


5. sudah ketampilan awal maka yang harus dilakukan adalah mengatur hak aksesnya dengan perintah

    #sudo chmod u+x array.sh

6. setelah persiapan sudah selesai maka jalankan programnya dengan perintah
   
     #./array.sh

     Berikut Outputnya



Jika tampil seperti gambar diatas maka program arraynya berhasil,,

Terima Kasih..

Share:

Label

Recent Posts