echo ‘literate woman = ‘$litwman
echo ‘illiterate man = ‘$ilitman
echo ‘illiterate woman = ‘$ilitwman
Sample Run
$sh prg98
total man = 41600
total woman = 38400
literate man = 28000
literate woman = 13600
illiterate man = 13600
illiterate woman = 24800
99. If the three sides of a triangle are entered through the keyboard. WAP to check whether the triangle is equilateral, isosceles, or scalene triangle.
$vi prg99
clear
echo Enter three sides of the triangle
read a b c
echo
if [ $a -eq $b -a $a -eq $c ]
then
echo Triangle is Equilateral
elif [ $a -eq $b -o $a -eq $c -o $b -eq $c ]
then
echo Triangle is Isosceles
elif echo Triangle is Scalene
fi
Sample Run
$sh prg99
Enter three sides of the triangle
30 75 75
Triangle is Isosceles
Enter three sides of the triangle
60 60 60
Triangle is Equilateral
Enter three sides of the triangle
38 30 35
Triangle is Scalene
100. An Insurance company follows following rules to calculate premium.
(
i
) If a person’s health is excellent and the person is between 25 and 35 years of age and lives in a city and is a male then Premium is Rs. 4 per thousand and his policy amount cannot exceed Rs. 2 lakhs.
(
ii
) If a person satisfies all the above conditions except that the sex is female then the premium is Rs. 3 per thousand and her policy amount cannot exceed Rs. 1 lakh.
(
iii
) if a person’s health is poor and the person is between 25 and 35 years of age and lives in a village and is a male then the Premium is Rs. 6 per thousand and his policy cannot exceed Rs. 10,000.
(
iv
) In all other cases the person is not insured.
Write a program to output whether the person should be insured or not, his/her Premium rate and maximum amount for which he/she can be insured.
$vi prg100
clear
echo Enter age of the person
read age
echo Enter where he lives (city or village)?
ead liv
echo Enter gender (male or female)?
read gender
echo Enter health (poor or excellent)?
read health
echo
if [ $age -ge 25 -a $age -le 35 -a $liv = ‘city’ -a $gender = ‘male’ -a $health = excellent]
then
echo The person should be insured
echo Premium is Rs.4 per thousand
echo Policy amount cannot exceed Rs.2 lakh
elif [ $age -ge 25 -a $age -le 35 -a $liv = ‘city’ -a $gender = ‘female’ -a $health = ‘excellent’ ]
then
echo The person should be insured
echo Premium is Rs.3 per thousand
echo Policy amount cannot exceed Rs.1 lakh
elif [ $age -ge 25 -a $age -le 35 -a $liv = ‘village’ -a $gender = ‘male’ -a $health = ‘poor’]
then
echo The person should be insured
echo Premium is Rs.6 per thousand
echo Policy amount cannot exceed Rs.10,000
else
echo The person should not be insured
fi
Sample Run
$sh prg100
Enter age of the person
26
Enter where he lives (city or village)?
city
Enter gender (male or female)?
male
Enter health (poor or excellent)?
excellent
The person should be insured
Premium is Rs.4 per thousand
Policy amount cannot exceed Rs.2 lakh
$sh prg100
Enter age of the person
33
Enter where he lives (city or village)?
city
Enter gender (male or female)?
female
Enter health (poor or excellent)?
excellent
The person should be insured
Premium is Rs.3 per thousand
Policy amount cannot exceed Rs.1 lakh
$sh prg100
Enter age of the person
3
Enter where he lives (city or village)?
village
Enter gender (male or female)?
male
Enter health (poor or excellent)?
poor
The person should be insured
Premium is Rs.6 per thousand
Policy amount cannot exceed Rs.10,000
$sh prg100
Enter age of the person
24
Enter where he lives (city or village)?
village
Enter gender (male or female)?
male
Enter health (poor or excellent)?
poor
The person should not be insured
Table of Contents
Front Cover
Title Page
Copyright
Contents
Preface
Acknowledgement
Part I: Introduction
Chapter I. An Overview
Chapter II. Salient Features of Unix
Chapter III. Hardware Requirements for Unix
Chapter IV. Getting Started
Chapter V. Unix Architecture
Chapter VI. Unix Basic Commands
Chapter VII. Portability with C
Part II: Programs