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
Your task for this project is to develop a system that would provide the following features: 1. Register new student 2. Drop student from university 3. Add a course and gr

Windows Card Space Windows Card Space (codenamed Info Card), is Windows now-canceled customer application for the Identification Met system. Card Place is an instance of a class of

What is URL describe theri protocol? URL basicallt stands for uniform resource locator. A URL is a pointer to a particular resource on the Internet at a particular location.

Is it possible to get an assignment done within 2 hours

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

Pre-order integration on Shopify store We are looking for on-call developers who can integrate Celery on client Shopify stores. Requirements a) Contented editing Shopify them

WS-Addressing, WS-Reliable Texting and WS-Security WCF tools many innovative Web solutions (WS) expectations such as WS-Addressing, WS-Reliable Texting and WS-Security. With the di


Explain the Comma Operator- Computer Programming? The comma has two utilization and the most common use is as a parameter separator for data types and function parameter lists. H

maake a programme in C of HR system