Beruflich Dokumente
Kultur Dokumente
read a1 a2
m1=$a1
m2=$a2
g=0
l=0
while [ $r -ne 0 ]
do
while [ $r -ne 0 ]
do
a1=$a2
a2=$r
done
done
l=`expr $g / $a2`
1
Roll no 9,29
output:-
12 10
gcd : 2
lcm : 60
read n
i=2
j=0
do
a=`expr $n % $i`
then
j=1
break
fi
i=`expr $i + 1`
done
if test $j -eq 1
2
Roll no 9,29
then
else
fi
output:-
enter a number
31
31 is prime
enter a number
4 is not prime
read k
n=2
do
i=2
3
Roll no 9,29
j=0
do
no=`expr $n % $i`
then
j=1
break
fi
i=`expr $i + 1`
done
if test $j -ne 1
then
echo "$n"
fi
n=`expr $n + 1`
done
output:
10
4
Roll no 9,29
read no
then
then
else
i=2
ctr=$i
do
i=`expr $i + 1`
done
fi
output:-
enter a number :
5 ! = 720
5
Roll no 9,29
5) Fibonacci Series
read k
n=0
a=0
b=1
echo "0"
echo "1"
k=`expr $k - 2`
do
no=`expr $a + $b`
echo "$no"
a=$b
b=$no
n=`expr $n + 1`
done
output:
$ sh gcde.txt
6
Roll no 9,29