fork download
  1. #include <stdio.h>
  2. #include <time.h>
  3.  
  4. int main(void) {
  5. const char *ds[] = {"Domingo", "Segunda", "Terca",
  6. "Quarta", "Quinta", "Sexta", "Sabado"};
  7. struct tm tm = {0};
  8. tm.tm_mday = 1;
  9. tm.tm_mon = 0; // Janeiro
  10. tm.tm_year = 113; // 2013
  11. tm.tm_isdst = 0;
  12. mktime(&tm); // normalizar tm
  13. printf("1 de Janeiro de %d calhou em %s.\n",
  14. tm.tm_year + 1900, ds[tm.tm_wday]);
  15. return 0;
  16. }
Success #stdin #stdout 0s 2140KB
stdin
Standard input is empty
stdout
1 de Janeiro de 2013 calhou em Terca.