Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int day,month,year,currday,currmo,curryea,lifey,lifem,lifed,totald;
- printf("Entre com a sua data de nascimento : (formato dd/mm/aaaa)\n");
- scanf("%d %d %d",&day,&month,&year);
- printf("Entre com a data autal : (formato dd/mm/aaaa)\n");
- scanf("%d %d %d",&currday,&currmo,&curryea);
- totald = (curryea*365 + currmo*30 + currday) - (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);
- if (lifey>=16)
- {
- printf("Voce ja pode votar!\n");
- }
- if ((lifey)>=18)
- {
- printf("Voce ja pode tirar a habilitacao!\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment