How do I write a C program to convert specified days into years, weeks, and days?
write a C program to convert specified days into years, weeks, and days
What is C : C is a general purpose programming language developed in 1972 by Dennis M. Ritchie at the Bell Laboratories to develop the UNIX operating system. C is most widely used computer programming language.
STEPS :-
- Take a number of days from the user.
- If you want to convert these number of days into year. then divide this number by 365 and obtain only quotient.
- now convert these number into weeks , then divide the number of days with 365 and takes only remainder and also divide remaining remainder value by 7 and obtain quotient.
- now last step is converted into days. for the number of days divide by 365 and obtain the remainder . further divide these remainder by 7 and obtain remainder.
Let’s See an example of it :-
Comments
Post a Comment