EXAMPLE PROBLEM
Johnson was working as a Captain of the Giant Ship. He was traveling from India to various countries around the world. The days of the travel may differ from one country to another.
To plan the upcoming travel the Johnson captain of the ship wold like to know the travel days in the year:month:day format.
Can you help Johnson?
Input:
Integer representing number days the ship was travelling.
Output:
Print the result in the prescribed format.
#include <stdio.h> int main() { int ndays,y,m,d; scanf("%d",&ndays); y=(int)ndays/365; ndays=ndays-(365*y); m=(int)ndays/30; d=(int)ndays-(m*30); printf("%d Y(s) %d M(s) %d D(s)",y,m,d); return 0; }
INPUT_1:
8721
OUTPUT:
23 Y(s) 10 M(s) 26 D(s)
INPUT_2:
1000
OUTPUT:
2 Y(s) 9 M(s) 0 D(s)
INPUT_3:
10000
OUTPUT:
27 Y(s) 4 M(s) 25 D(s)
INPUT_4:
5000
OUTPUT:
13 Y(s) 8 M(s) 15 D(s)
INPUT_5:
9451
OUTPUT:
25 Y(s) 10 M(s) 26 D(s)
ILLUSTRATION
Morae Q!
- Convert seconds to hours – HMS format.
- Find out the tax amount of the bill with tip for the meal.
- Find the area of the pyramid.
- Find the area of triangle using heron’s formula.
- Find the interest and amount resided in the bank.
- Convert the travel days to years and months.
- Find the first three powers of N number.
- Compute the height from feet and inches to centimetres.
- Calculate the amount of interest earned in the bank.
- Find the ways they can choose the sequence of dummy statues.
- Find the Lapindrome strings.
- Classify the salary of a person.
- Find the day on providing the week number.
- Find the least number of marble stones needed to pave the square mall.
- Find the number of steps on chessboard performed to satisfy a condition.
- Find the time, hours and minutes the train was delayed.
- Find the quantity of food packets shared and available.
- Compute all Arithmetic Operations.
- Find the amount to pay for the electricity bill.
- Find the sum of numbers with three values after decimal point.