Write a shell program. Enter number of days from keyboard.
Find out the number of years, month and days it contains



Write a shell program. Enter number of days from keyboard. Find out the number of years, month and ..

Answer / Avadhesh Kumar

```bashn#!/bin/bashnnecho "Enter number of days:"nread daysnnyears=$(($days/365))ndays_remaining=$days$(($days%365))nmonths=$(($days_remaining/30))ndays_remaining=$(($days_remaining%30))necho "Number of years: $years"necho "Number of months: $months"necho "Number of remaining days: $days_remaining"n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Programming Languages AllOther Interview Questions

why we use static with only main()class not with other class

2 Answers   TCS,


what is the main usage of an abstract keyword?please follow the program class A { void display() { System.out.println("hai"); } void print() { } } class B extends A { void print() { System.out.println("Hello"); } } In this program i was gives the implementation of print() according to my requirements in subclass.And there is no definition in superclass then why we can use abstract keyword before a method that i want to gives definition in other classes,is any mistakes in the above usage of method?

1 Answers  


cobol is execution r not without jcl

0 Answers   IBM,


what are methods we have in connection pooling

1 Answers   Wipro,


can we allocate memory for interface? if no then why?

1 Answers  


what is the difference between set and append?

3 Answers   ICICI,


what is class module in vb6? what it's use? with example..

0 Answers  


how do we provide security for web services

1 Answers  


< No Frames > tag is used for

1 Answers  


5.Call by value and Call by reference with program?

1 Answers  


there are N number of matchboxes numbered 1...N.each matchbox contain various number of stick.Two player can alternatevely pick some amount of stick from the higest stick containing box . The player is condidered win if there is no stick after his move.Find the final move so that the move player win. Note:In case the number of stick is equal ,pick the stick from the higest numbered box. eg: 3 box contain stick as:1,1,1. if u take 1 stick from 3rd numbred box you will any how win the match.

1 Answers   Manhattan,


What is the Super Class of Exception in java?

11 Answers   Andesa Services, Benchmark, CitiGroup, CMC, Evergent, KOT Systems, Value Labs, Vijay infoart Solutions,


Categories