libchm icon

jfc

libchm | PRO | 12/21/21 03:43:25 PM UTC | 0 ⭐ | 1135 👁️ | Never ⏰ | []
C++ |

500 B

|

None

|

0 👍

/

0 👎

#include <iostream>
#include <time.h>
 
using namespace std;
 
int main(int argc, char **argv)
{
    int n, day, month = 0, months[13] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365};
    cout << "Lūdzu ievadiet dienas vērtību no 1-365: ";
    cin >> n;
    while (n > 3) {
        n -= 365;
    }
    while (months[month] < n) {
        month++;
    }
    day = n - months[month-1];
    cout << n << " Diena būs " << day << "." << month << ".2005" << endl;
 
    return 0;
}

Comments