Advertisement
peterzig

2. Age in Seconds (beta)

Sep 19th, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <conio.h>
  2. #include <iostream>
  3. #include <inttypes.h>
  4.  
  5. using namespace std;
  6. int main()
  7. {
  8.     int age, days;
  9.     unsigned long long sec;
  10.     cout << "Write your age in years: " ;
  11.     cin >> age;
  12.     days = age * 365;
  13.     sec = age * 31556926;
  14.     cout << "\nYour age in years: " << age << endl;
  15.     cout << "\nYour age in days: " << days << endl;
  16.     printf("\nYour age in seconds %llu ", sec); // Works only for 68 yrs old, older ppl need array :)
  17.     _getch();
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement