GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Operating System  >  Unix Programming
Go To First  |  Previous Question  |  Next Question 
 Unix Programming  |  Question 42 of 43    Print  
Find Smallest of 3 Numbers
Write a shell script to find the smallest of three numbers that are read from the keyboard.


  
Total Answers and Comments: 1 Last Update: September 07, 2009     Asked by: pankajforall2003 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
September 07, 2009 04:03:34   #1  
goksn Member Since: May 2009   Contribution: 94    

RE: Find Smallest of 3 Numbers
echo first_num
read first_num
echo second_num
read second_num
echo third_num
read third_num

if (first_num>second_num) then
if (first_num>third_num) then
echo $first_num is the biggest
else
echo $third_num is the biggest
elif
(second_num>third_num) then
echo $second_num is the biggest
else
echo$third_num is the biggest


or else we can use sort command

sort -r



 
Is this answer useful? Yes | No

 Related Questions

Latest Answer : find / -atime  -30 ...
Read Answers (2) | Asked by : norman

Latest Answer : You can also use "finger" ...
Read Answers (2) | Asked by : nimish

Create a program to find out the inode number of any desired file 
Latest Answer : read fname     #file name to be searched.p=`pwd`cd /l=`find -name $fname`l=`echo $l | ls -i`set $lecho "inode is $1"cd $p ...

Write a shell script that accept any number of arguments and print them in the reverse order 

Write a shell script to find the smallest of three numbers that are read from the keyboard. 
Latest Answer : echo first_numread first_numecho second_numread second_numecho third_numread third_numif (first_num>second_num) then if (first_num>third_num) then echo $first_num is the biggest else echo $third_num is the biggestelif ...


 Sponsored Links

 
Related Articles

Concepts of Object-Oriented Programming

Object Oriented JavaScript In this chapter you ll learn about OOP Object Oriented Programming and how it relates to JavaScript As an ASP NET developer you probably have some experience working with objects and you may even be familiar with concepts such as inheritance However unless you re already a
 

How to call C header that is not provided generally by system in C++?

Headers can be called by using extern C Syntax of extern C is: extern "C" <function declaration> for example to call C functions from C++ we can write extern "C" { <function declaration> <function declaration> ...
 

SQL Programming

SQL Programming Overview Anybody who has done something for a long time has probably wanted to change how things work at some point or another. A worker at a mill might have found a more efficient way of cutting logs, or a mathematics teacher might have had a hand in changing a school’s al
 

System Implementation

In the previous articles relating to SDLC Stages we discussed about Project Planning and Feasibility Study moved on to System Analysis and Requirements which lead to Systems Design. Systems Design will naturally lead to another stage where it becomes closer to the actual deployment of the p
 

System Analysis and Requirements

In the previous chapter, we’ve discussed about project planning and feasibility study. That stage was important because it tries to establish a problem in our highly technological world. As our understanding on what we can do in computers evolve and so are the things that we need to make t
 

The Interview Snafu

How to turn someone else’s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won’t get over the line without a polished, prof
 

WinRunner Programming Concepts

If you want to create WinRunner scripts that are highly efficient, there are important programming concepts that you will want to become familiar with. Understanding these concepts will provide you with a large number of key benefits. In addition to understanding these concepts, you must also learn
 

Programming Languages Certification

IT Certification programs have several options that will offer you the best knowledge.  By learning everything that you need to know about information technology you will be able to open new doors to your career and personal business desires.  IT Certification offers several vari
 

Operating Systems and IT Certification

With the burst of information technology that is becoming a part of the dominant culture throughout the world, are programs that are designed to help those in this area to grow in knowledge.  By understanding the different technologies that are available, one is able to use them and impleme
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape