Powered by Blogger.
Showing posts with label OS. Show all posts
Showing posts with label OS. Show all posts

Write a shell script to check whether a given number is an Armstrong number or not.

echo "Enter a number: " read c x=$c sum=0 r=0 n=0 while [ $x -gt 0 ] do r=`expr $x % 10` n=`expr $r \* $r \* $...
Read More

Write a shell script to check whether a given number is prime or not.

echo "Enter a number: " read num i=2 f=0 while [ $i -le `expr $num / 2` ] do if [ `expr $num % $i` -eq 0 ] then f=1...
Read More

Write a shell script to find the sum of the first n numbers.

echo "Enter a number: " read num i=1 sum=0 while [ $i -le $num ] do sum=`expr $sum + $i` i=`expr $i + 1` done echo...
Read More

Write a shell script to find whether a given year(4 digits)is leap year or not.

echo "Enter the year in 4 digits: " read num if [ $num -ge 1000 -a $num -le 9999 ] then  if [ `expr $num % 4` -eq 0 ] ...
Read More

Write a shell script to find whether a given number is even or odd.

echo "Enter a number: " read num if [ `expr $num % 2` -eq 0 ] then echo "$num is Even." else echo "$n...
Read More

Write a shell script to find the simple interest.

echo "Enter the Principle Amount: " read p echo "Enter the rate of interest: " read r echo "Enter the nu...
Read More

Write a shell script to find the largest of three numbers and also find the total and the average.

echo "Enter the 1st Number: " read n1 echo "Enter the 2nd Number: " read n2 echo "Enter the 3rd Number...
Read More

Write a shell script to accept marks for all the subjects of sybca and display the Marks sheet of the student,including the total, average and class.

                          if average is 60 or above then display "first class". -if average is 50 or less than 60 then ...
Read More