Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void agecal(day,month,year,currd,currm,curry)
- {
- int totald,lifey,lifem,lifed;
- totald = (curry*365 + currm*30 + currd) - (year*365 + month*30 + day);
- lifey = totald/365;
- lifem = (totald%365)/30;
- lifed = totald - (lifey*365 + lifem*30);
- printf("Voce possui %d anos, %d meses e %d dias de vida.\n",lifey,lifem,lifed);
- return;
- }
- int main()
- {
- int day,month,year,currd,currm,curry;
- printf("Entre com a sua data de nascimento : (formato dd/mm/yyyy)\n");
- scanf("%d %d %d",&day,&month,&year);
- printf("Entre com a data de hoje : (formato dd/mm/yyyy\n");
- scanf("%d %d %d",&currd,&currm,&curry);
- agecal(day,month,year,currd,currm,curry);
- if ((month<3)&&(month>=1))
- {
- printf("Voce nasceu no primeiro trimestre!\n");
- if ((month==1)&&(day<=20)) printf("Signo : Capricornio!\n");
- else if ((month<=2)&&(day<=19)) printf("Signo : Aquario!\n");
- else printf("Signo : Peixes!\n");
- }
- else if ((month<6)&&(month>=1))
- {
- printf("Voce nasceu no segundo trimestre!\n");
- if ((month==3)&&(day<=20)) printf("Signo : Peixes!\n");
- else if ((month<=4)&&(day<=20)) printf("Signo : Aries!\n");
- else if ((month<=5)&&(day<=21)) printf("Signo : Touro!\n");
- else printf("Signo : Gemeos!\n");
- }
- else if ((month<9)&&(month>=1))
- {
- printf("Voce nasceu no terceiro trimestre!\n");
- if ((month==6)&&(day<=21)) printf("Signo : Gemeos!\n");
- else if ((month<=7)&&(day<=23)) printf("Signo : Cancer!\n");
- else if ((month<=8)&&(day<=23)) printf("Signo : Leao!\n");
- else printf("Signo : Virgem!\n");
- }
- else if ((month<=12)&&(month>=1))
- {
- printf("Voce nasceu no quarto trimestre!\n");
- if ((month==9)&&(day<=23)) printf("Signo : Virgem!\n");
- else if ((month<=10)&&(day<=23)) printf("Signo : Libra!\n");
- else if ((month<=11)&&(day<=22)) printf("Signo : Escorpiao!\n");
- else if ((month<=12)&&(day<=21)) printf("Signo : Sagitario!\n");
- else printf("Signo : Capricornio!\n");
- }
- else printf("DATA INVALIDA!\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment