Beecrowd 1020 Solution in C, C++ & Python

URI – BEECROWD – BEE Online Judge || Age In Days – URI – BEE 1020 Solution in C,C++, Python

Question

#include <stdio.h>

int main() {

   int d,y,m;
   scanf("%d",&d);
   y=0;
   m=0;
   y=d/365;
   d=d%365;
   m=d/30;
   d=d%30;
   printf("%d ano(s)\n%d mes(es)\n%d dia(s)\n",y,m,d);
    return 0;
}

Bee1020 Solution in C++

#include <iostream>
using namespace std;

int main() {
    int d, y, m;
   cin >> d;
    y = 0;
    m = 0;
    y = d / 365;
    d = d % 365;
    m = d / 30;
    d = d % 30;
    cout << y << " ano(s)\n" << m << " mes(es)\n" << d << " dia(s)\n";
    return 0;
}

Bee1020 Solution in Python

d = int(input())
y = 0
m = 0
y = d // 365
d = d % 365
m = d // 30
d = d % 30
print(f"{y} ano(s)\n{m} mes(es)\n{d} dia(s)")

Beecrowd 1019 solution || URI – BEECROWD – BEE 1019 Time Conversion Solutions in C, C++, and Python

1 thought on “Beecrowd 1020 Solution in C, C++ & Python”

Leave a Comment