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
Given grammar Grammar M following: 1 - - > begin end 2 - - > 3 - - > 4 - - > ? 5 - - > Id : = ; 6 - - > read ( ) ; 7 - - > write ( )

For this assignment you will use the robot/maze simulation example introduced in mini-assignments 0625ma-0627ma to develop a maze-solving program. The program will read a file cont

The ?rst task in the project is to develop a sane system to store change logs and versions of ?les. The simplest approach is to create a "dot" directory in the location of the ?le


program the following exercises using JAVA and JENA API: SPARQL endpoint to be queried: QUERY:">http://services.data.gov.uk/education/sparql QUERY: What are the school’s names th

Windows Workflow Foundation Microsoft windows Work-flows foundation (WF) is an Enthusiasm technological innovation that provides an API, an in-process workflow website, and a rehos

i attached the assignment document only i need your help with following three parts: accessible areas, accessible cul-de-sacs that are all connected, entry-exit path with no in

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

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4