June 12, 2009

Membuat konversi nilai dengan Shell Linux

Posted in Linux tagged at 7:52 am by yahya

nih… carane buat konversi nilai (angka) –> huruf dengan pemrograman shell di Linux
source code:

#!/bin/sh
#myname 12080xxx
echo -n "masukkan angka (1-100) : " 
read x;

if [ $x -ge 81 -a $x -le 100 ]
	then
	X='A';
	echo "Nilai $X";
elif [ $x -ge 71 -a $x -le 80 ]
	then
	X='B';
	echo "Nilai $X";
elif [ $x -ge 61 -a $x -le 70 ]
	then
	X='C';
	echo "Nilai $X";
elif [ $x -ge 51 -a $x -le 60 ]
	then
	X='D';
	echo "Nilai $X";
elif [ $x -ge 1 -a $x -le 50 ]
	then
	X='E';
	echo "Nilai $X";
else
	echo "Nilai  SALAH";
fi

exit 0

————–
gitu deh…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: