Bilangan Prima

clear g="====================================================" echo $g echo " Bilangan Prima" echo $g echo " " a=0 b=0 echo -n "Masukkan batasan bilangan prima yang ingin ditampilkan :" read b echo " " echo "2" for (( i=1; i<=$b; )) do for (( j=i-1; j>=2; )) do if [ `expr $i % $j` -ne 0 ];then a=1 else a=0 break fi j=`expr $j - 1` done if [ $a -eq 1 ];then echo $i fi i=`expr $i + 1` done
input batas dari bil prima yang akan di cetak

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.