Machine Problem
Write a program to ask the user to give input number of days and convert it to years, weeks, and days
and display the result on the screen.
I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Program Listing
/* days.c
Convert days to years weeks and days
Author : Jake R. Pomperada, MAED-IT, MIT
www.jakerpomperada.blogspot.com
www.jakerpomperada.com
jakerpomperada@gmail.com
Bacolod City, Negros Occidental Philippines
*/
#include <stdio.h>
int main()
{
int days=0, years=0, weeks=0;
system("COLOR F0");
printf("\n\n");
printf("\tConvert Days to Years, Weeks and Days");
printf("\n\n");
printf("\tHow Many Days : ");
scanf("%d", &days);
/* Conversion in this portion */
years = (days / 365); /* Ignoring leap year */
weeks = (days % 365) / 7;
days = days - ((years * 365) + (weeks * 7));
printf("\n\n");
printf("\tDisplay Results");
printf("\n\n");
printf("\tNumber of Years : %d\n", years);
printf("\tNumber of Weeks : %d\n", weeks);
printf("\tNumber of Days : %d", days);
printf("\n\n\n");
printf("\tEND OF PROGRAM");
printf("\n\n");
}
No comments:
Post a Comment