File tree 1 file changed +31
-0
lines changed
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include <stdio.h>
2
+ #include <stdlib.h>
3
+ #include <math.h>
4
+
5
+ int main (void ){
6
+ double years = 0 ;
7
+ double secs = 0 ; // U have no secs lol
8
+ double bils = 0 ,mils = 0 ,thous = 0 ;
9
+
10
+ printf ("How old are you (in years)? \n" ); // the tin
11
+ scanf ("%lf" , & years );
12
+ //printf("%lf", years); // Just checking
13
+ secs = (years * 365.2425 ) * 86400 ; // A day has 86400, Gregorian calendar says 365.2425 days/year
14
+ printf ("That's " );
15
+ if (secs >= 1000000000 ){
16
+ bils = floor (secs / 1000000000 );
17
+ printf ("%.0lf billion, " , bils );
18
+ secs -= bils * 1000000000 ;
19
+ }
20
+ if (secs >= 1000000 ){
21
+ mils = floor (secs / 1000000 );
22
+ printf ("%.0lf million, " , mils );
23
+ secs -= mils * 1000000 ;
24
+ }
25
+ if (secs >= 1000 ){
26
+ thous = floor (secs / 1000 );
27
+ printf ("%.0lf thousand, and " , thous );
28
+ secs -= thous * 1000 ;
29
+ }
30
+ printf ("%.0lf second(s). And counting." , secs );
31
+ }
You can’t perform that action at this time.
0 commit comments