Social Icons

Wednesday, 1 May 2013

Geometric Progression Using shell


#!/bin/sh

echo -n "Enter First No. of G.P :  "
read  a
echo -n "Enter Common Ratio of G.p :"
read r
echo -n  "how many no. you want to print : "
read  n
echo " .............G.p is : ........   "

while [ $n -gt 0 ]
do
echo -n "$a "
a=$(($a*$r))
n=$(($n-1))
done

exit 0

No comments:

Post a Comment

 

Sample Text

Sample text

 
Just Programming Cse DriveReputation Management