No result found.

Outline

  • Pattern printing

  • Factorial Calculation

  • Sum of all digit in a no.

OS

Varun Chouhan17 Feb, 2020

Pattern printing

        for ((i= 1; i <=5; i ++))
do 
for ((j=1; j<=i; j++))
do
printf "x"
done
printf "\n"
done.
      
        for (i= 1; i <=4; i ++))
do 
for ((j=1; j<=i; j++))
do
printf "$i"
done
printf "\n"
done.
      
        for (i= 5; i >=1 i--))
do 
for (j=1; j<=5; j++))
do
if [$;-ge $i]
then
printf "*"
else
printf ""
fi
done
done.
      

Factorial Calculation

        fact=1
echo"Enter a no."
read n
for(( i=1; i<=n; i++ ))
do
Fact =$(($fact*i))
done
echo Factorial is $fact
      

Sum of all digit in a no.

        echo"Enter a no."
read n
sum=0
while[[n-gt 0]]
do
r=$(($n%10))
sum=$(($sum+r))
n=$(($n/10))
done
echo sum is $sum

      
View PDF

It is the main PDF of the project. Therefore it contains all the programs with details and with proper coding.