All pastes #95169 Raw Edit

time

public cpp v1 · immutable
#95169 ·published 2006-07-21 20:10 UTC
rendered paste body
inline int przestepny(int y){  if(y % 400 == 0)    return 1;  if(y % 4 == 0)    if(y % 100 != 0)      return 1;  return 0;}int dzien_roku(int d, int m, int y){  if(m == 1)    return d;  if(m == 2)    return (d + 31);  int bonus = przestepny(y);  if(m < 8)    return (d + 28 + bonus + (m - 2) * 30 + m / 2);  return (d + 28 + bonus + (m - 2) * 30 + 1 + (m - 1) / 2);}int main(void){  int d, m, y;  int bonus = 0;  cin >> d >> m >> y;  cout << "Podany dzien jest " << dzien_roku(d, m, y) << " dniem roku" << endl;  return 0;}