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
Example : Find the general solution to the subsequent differential equation. x 2 y′′ - 7 xy′ + 16 y= 0   Solution First the roots of (3)  r (r -1) - 7r + 16= 0 r 2

1. Write a Perl script that accepts exactly 2 integer arguments where the first argument must be less than the second argument. The script will print a comma separated list of inte

Expertsmind brings you unique solution in java assignments Reflection API Uses of Reflection with java assignment help Reflection is widely used by applications which

How to lunch webcame via viusal studio 2012

Is it possible to get an assignment done within 2 hours

Microsoft's VC++ Windows V C++ was a highly effective device. But it was too complicated. It has too many information kinds, and designers had to understand many your local lib

Please remember to read and follow all of the assignment guidelines. This assignment will expand upon the simulation algorithm given in class to produce a program which may be u

Eclipse Jsp Project. I am making a a project on my website and i was making a help support page on which the user can submit their question and the question is saved to a text file

Expertsmind brings you unique solution in java assignments Packages A Java packages is a process for planning Java sessions into namespaces just like the segments of Modu

This assignment is divided into two parts. The goal is to write a Java program that calculates capital gain on a stock market, see Lab 7. When a share of common stock of some co