skip to main |
skip to sidebar
Question#6
Question#6: Age Calculator: Program asks for age and prints how many months, weeks, days, hours and minutes old you are.
#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();}
Output:
No comments:
Post a Comment