Write a shell script to Accept number and check the number is even or odd, finds the length of the number, sum of the digits in the number.
clear
echo "Enter Number : "
read no
count=0
total=0
if [ `expr $no % 2` -eq 0 ]
then
echo "NUMBER IS EVEN"
else
echo "NUMBER IS ODD"
fi
while [ $no -ne 0 ]
do
a=`expr $no % 10`
no=`expr $no / 10`
total=`expr $total + $a`
count=`expr $count + 1`
done
echo "Sum of All Digit : $total"
echo "Total No. of Digit : $count"
echo "Enter Number : "
read no
count=0
total=0
if [ `expr $no % 2` -eq 0 ]
then
echo "NUMBER IS EVEN"
else
echo "NUMBER IS ODD"
fi
while [ $no -ne 0 ]
do
a=`expr $no % 10`
no=`expr $no / 10`
total=`expr $total + $a`
count=`expr $count + 1`
done
echo "Sum of All Digit : $total"
echo "Total No. of Digit : $count"
Labels:
shell script
|
4
comments
Write a shell script to accept the string and checks whether the string is palindrome or not.
clear
echo "Enter String : \c"
read str
len=`echo $str|wc -c`
len=`expr $len - 1`
echo "length of String : "$len
i=1
while [ $i -le $len ]
do
revstr=`echo $str|cut -c$i`$revstr
i=`expr $i + 1`
done
if [ "$revstr" = "$str" ]
then
echo "Your string is palindrome"
else
echo "Your string is not palindrome"
fi
echo "Enter String : \c"
read str
len=`echo $str|wc -c`
len=`expr $len - 1`
echo "length of String : "$len
i=1
while [ $i -le $len ]
do
revstr=`echo $str|cut -c$i`$revstr
i=`expr $i + 1`
done
if [ "$revstr" = "$str" ]
then
echo "Your string is palindrome"
else
echo "Your string is not palindrome"
fi
Labels:
shell script
|
0
comments
Write a shell script to accept numbers and perform addition, subtraction, division and multiplication.
echo "Enter Number 1 : "
read a
echo "Enter Number 2 : "
read b
ans=`expr $a + $b`
echo "Addition : " $ans
ans=`expr $a - $b`
echo "Subtraction : " $ans
ans=`expr $a / $b`
echo "Division : " $ans
ans=`expr $a \* $b`
echo "Multiplication : " $ans
read a
echo "Enter Number 2 : "
read b
ans=`expr $a + $b`
echo "Addition : " $ans
ans=`expr $a - $b`
echo "Subtraction : " $ans
ans=`expr $a / $b`
echo "Division : " $ans
ans=`expr $a \* $b`
echo "Multiplication : " $ans
Labels:
shell script
|
2
comments
Be a freelancers and become your own Boss
Are you looking for good Job?
Do you interested to earn dollars?
Are you satisfied with your daily hectic schedule of Job?
Are you interested to work form your home or what ever the place you like?
What your answer is yes !!!
here is the solutionBe a Freelancer and become your own boss
Just read article of The Economic Times
Vacancy for IT Peoples in Indian Navy
Join Indian Navy
our Indian Navy invites unmarried Male to join Navy a (SSC) Officers in Executive Branch (Information Technology) for December-2012 Course
Subscribe to:
Posts (Atom)
Subjects
- WordPress
- Mobile Computing-4649303 Practical Solution
- Android Programming New Syllabus Theory
- PHP LAMP Question Bank
- PHP LAMP Theory
- Step by Step Android Example
- Android Practical
- Android Theory
- Android Question Bank
- Networking FON Practical
- Networking FON Theory
- OS Practical
- OS Theory
- HTML
- JavaScript
- J2EE WTAD Theory
- J2EE WTAD Question Bank
- J2EE WTAD Quick Guide
- J2EE WTAD GTU Papers
- J2EE WTAD Practical
- Python
- JAVA Theory
- JAVA Practical
- MIS
Categories
- Android (55)
- CSS (3)
- Configure Tomcat7 (2)
- Decryption (16)
- Difference (1)
- Encryption (16)
- Error Detection and Correction Techniques (3)
- FON (27)
- Framing Technic (2)
- J2EE (29)
- JAVA (13)
- JavaScript (19)
- OS (17)
- PHP (11)
- Protocol (3)
- SERVER SOCKET PROGRAMING (7)
- Servlet (13)
- WTAD (34)
- c (11)
- install Tomcat (2)
- linux (8)
- shell script (33)
- unix (22)
Total Pageviews
© BipinRupadiya.com. Powered by Blogger.