Advertisement
libchm

jfc

Dec 21st, 2021
797
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <time.h>
  3.  
  4. using namespace std;
  5.  
  6. int main(int argc, char **argv)
  7. {
  8.     int n, day, month = 0, months[13] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365};
  9.     cout << "Lūdzu ievadiet dienas vērtību no 1-365: ";
  10.     cin >> n;
  11.     while (n > 3) {
  12.         n -= 365;
  13.     }
  14.     while (months[month] < n) {
  15.         month++;
  16.     }
  17.     day = n - months[month-1];
  18.     cout << n << " Diena būs " << day << "." << month << ".2005" << endl;
  19.  
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement