Enter no of hours days months years contains pattern , Programming Languages

Enter number of hours and find days, months and years.

 

echo -e "Enter Hours: \c"

read hr

echo "hour=$hr"

day=0

mon=0

yr=0

yr=`echo "$hr/365" | bc `

tmp=`echo "$hr%365" | bc`

mon=`echo "$tmp/30" |bc`

day=`echo "$tmp%30" | bc`

echo -e "$hr hours =  $yr years and  $mon months and  $day days"

 

Output

sh cnthour.sh

Enter Hours: 450

hour=450

450 hours =  1 years and  2 months and  25 days

 

sh cnthour.sh

Enter Hours: 370

hour=370

370 hours =  1 years and  0 months and  5 days

 

Posted Date: 9/26/2012 8:36:58 AM | Location : United States







Related Discussions:- Enter no of hours days months years contains pattern , Assignment Help, Ask Question on Enter no of hours days months years contains pattern , Get Answer, Expert's Help, Enter no of hours days months years contains pattern Discussions

Write discussion on Enter no of hours days months years contains pattern
Your posts are moderated
Related Questions

As with 2 nd order differential equations we can't determine a non-homogeneous differential equation unless we can initially solve the homogeneous differential equation. We'll als


Open error message coming out when compiling

Assignment is to create hijara game on any plate form, you can use any plate form you like or easy to you. For instance let's say you can use visual studio, game studio (Prefer to

Write out the Syntax of Nested if Statements? The universal form is                         If(expression 1)                         {

Produce a hierarchy chart, a structured flowchart, and a Pascal program (with appropriate comments) to generate the Sales Commission Report shown below. The commission for each sal

Many applications require entering a number from a button and then the device counts that number down.  If it is a 2 digit number it can be stored in a single register.  If it is l

A manager at the local Walmart needs to determine how many workers to hire to cover a 24-hour period. Each worker must work 9 consecutive hours but may only start work at the begin

What are the main pros and cons of assembly programming language?