Sie sind auf Seite 1von 7

# c  

m1=\$a1

m2=\$a2

g=0

l=0

## r=`expr \$a1 % \$a2`

while [ \$r -ne 0 ]

do

## r=`expr \$a1 % \$a2`

while [ \$r -ne 0 ]

do

a1=\$a2

a2=\$r

done

done

## g=`expr \$m1 "*" \$m2`

l=`expr \$g / \$a2`



c  


output:-

12 10

gcd : 2

lcm : 60

i=2

j=0

do

a=`expr \$n % \$i`

then

j=1

break

fi

i=`expr \$i + 1`

done

if test \$j -eq 1



c  


then

else

fi

output:-

enter a number

31

31 is prime

enter a number

4 is not prime

n=2

do

i=2



c  


j=0

## while test \$i -lt \$n

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



c  


then

then

else

i=2

ctr=\$i

do

i=`expr \$i + 1`

done

## echo "\$no ! = \$ctr"

fi

output:-

enter a number :

5 ! = 720



c  


5) Fibonacci Series

n=0

a=0

b=1

echo "0"

echo "1"

k=`expr \$k - 2`

## while test \$n -lt \$k

do

no=`expr \$a + \$b`

echo "\$no"

a=\$b

b=\$no

n=`expr \$n + 1`

done

output:

\$ sh gcde.txt



c  



