/*============================================================================== _ ____ _____ __ __ (_) _ \ ___ |_ _|__ __ _| \/ | | | |_) / __| | |/ _ \/ _` | |\/| | | | __/\__ \ | | __/ (_| | | | | |_|_| |___/ |_|\___|\__,_|_| |_| [iPs] Saber dia da Semana Criado por: [iPs]DraKiNs (agradecimentos a Crush) Versão 0.1 ==============================================================================*/ #include main() { system("title [iPs TeaM] - Que dia da semana?"); system("color 8f"); int day = 0, month = 0, year = 0; // ==== [ Dia ] ======== printf("Digite o dia: "); scanf("%d", &day); // ==== [ Mês ] ======== printf("Digite o mês: "); scanf("%d", &month); // ==== [ Ano ] ======== printf("Digite o ano: "); scanf("%d", &year); // ==== [ Processar ] ======== char sStr[24] = ("Dia Invalido"); int iBissext = (year % 100), iWeekDay = (year / 100); if(month < 3) month += 12,year--; int iWeek = ((day + (month+1)*26/10 + iBissext + iBissext/4 + iWeekDay/4 - 2*iWeekDay) % 7); if(iWeek == 0) strcpy(sStr , ("Sábado")); if(iWeek == 1) strcpy(sStr , ("Domingo")); if(iWeek == 2) strcpy(sStr , ("Segunda")); if(iWeek == 3) strcpy(sStr , ("Terça")); if(iWeek == 4) strcpy(sStr , ("Quarta")); if(iWeek == 5) strcpy(sStr , ("Quinta")) ; if(iWeek == 6) strcpy(sStr , ("Sexta")); printf("O dia da semana desta data foi %s \n",sStr); return system("pause"); }