If you are learning C programming, you might have encountered some problems that require you to convert a given number of days into years, weeks and days. For example, how many years, weeks and days are there in 1000 days? How about 3650 days? In this program, I will show you how to write a simple C program that can perform this conversion for any number of days. You will also learn some basic concepts of C programming, such as variables, data types, operators, input/output and comments. C program To convert days into years, weeks and days, we need to follow these steps: Declare four integer variables: 'days', 'years', 'weeks' and 'rem'. Ask the user to enter the number of days and store it in the variable 'days'. Divide the number of days by 365 to get the number of years and store it in the variable 'years'. Find the remainder of the division by 365 to get the remaining days and store it in the variable 'rem'. Divide the remain
Comments
Post a Comment