Saturday, October 11, 2008

QUESTION #6

Question:
Age Calculator: It will compute the age and prints how many months, weeks, days, hours and minutes old you are now.

Answer:
#include

/* Programmed by Harvey Losin *//* http://www.bikoy.com/harvey *//*
webmaster@bikoy.com */
main()
{ float years;
clrscr();
printf("Enter your age in years: ");scanf("%f",&years);
printf ("\nYou are %.0f months old", years * 12);
printf ("\nYou are %.0f weeks old", years * 48);
printf ("\nYou are %.0f days old", years * 365);
printf ("\nYou are %.0f hours old", years * 8760);
printf ("\nYou are %.0f minutes old", years * 525600);
getch();
}

No comments: