ccplusplus.com
Learn C, C++ Concepts
Saturday, September 10, 2011
convert days to years months days c code
/****************************************************** * File : convert-days-to-years-months-days.c * Author : Saurabh Gupta * Source : http://saurabhgupta0527.blogspot.com/ * Created : PM 05:51 10 September 2011 *****************************************************/ #include
#include
#include
int main(int argc, char **argv) { int nNumberOfDays; printf("Enter days : "); scanf("%d",&nNumberOfDays); printf("%d years,%d months,%d days\n", nNumberOfDays/365, (nNumberOfDays%365)/30, (nNumberOfDays%365)%30); return 0; } /* * OUTPUT * [sgupta@rhel54x64 c]$ [sgupta@rhel54x64 c]$ ./convert-days-to-years-months-days Enter days : 365 1 years,0 months,0 days [sgupta@rhel54x64 c]$ */
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment