Tutorials

How to make PseInt determine when a leap year easily?

Leap years are those that are divisible by 4 like 2008, and also have the particularity of bringing one more day (February 29). These years are easy to calculate and there are even codes to know what the next ones will be. With that in mind today you will learn how to make PseInt determine when a year is a leap year.

And the thing is, technology has advanced so much that today you can determine what you want, just by having the right program. What has brought benefits for human beings, such as improving response times to many questions that previously had to be solved manually.

Before starting it is recommended to download and install Pseint latest version , on your computer you can do that from its official website.

Conditions for a leap year

The first thing you have to take into account to start the process that will allow you to answer the question posed by How to make PseInt determine when a year is a leap year? , are the parameters or conditions that determine whether a year is a leap year or not.

These are: that it must be divisible by the number 4, that is, when dividing it, the final product can be 0, (some examples would be: 2006, 2008, 2012, among others).

It cannot be divisible by 100. The years that meet the previous condition are not necessarily leap, what really determines it is whether those that meet the first also enter the second.

brain with colored lights

 

And finally, the final condition is that it be divisible by 400, but this only applies if the first and not the second is met.

With this information you can now proceed to make your code, since you know what are the necessary parameters that it must meet each year, to earn this feature.

How to make PseInt determine when a year is a leap year?

With all the above that you have read, you are ready to make PseInt determine when a year is a leap year, the first thing you have to do to start the process is to open the program.

Once you are inside, you must give your program a name such as: leap year. Then, use the command “Write ” and in quotation marks put the message that you want to appear to the user who is using the program, in your case put: put the year to evaluate.

Then put the command “Read ” and put a variable with the name you want, such as year. Then you must enter the first condition of leap years as follows:

Put the command “Yes ” then the variable year and then the command “Mod ” followed by 4 = 0, it would be something like: if year mod 4 = 0.

In that same line, followed by 0, place the function “ Y ” and then create a double parenthesis ((. Immediately place the variable year again and then the mod function to finish by placing the different symbol <> and a 0, to finish close with a parenthesis.

February 29th Leap Year Poster

 

With that, you will have the second condition set. Now we only need to place the third, which goes on the same line, begins with the function “O ” after the parentheses.

It continues with a new parenthesis where the year variable goes first, the mod function second and the number 400 = 0 third, ending with a double parenthesis.

When all of the above is ready, put the function “Then ” and “Write ” in a row. In writing, put in quotes a message such as: if it is a leap year.

In the line below use the function “If not ” and then “Write “, and put, it is not a leap year. With that everything will be ready, you just need to try the program. Finally the question How to make PseInt determine when a year is a leap year ?, was answered.

What is PseInt?

As a little extra, you will now see that it is this program that you have learned about. It is basically an educational software that allows you to teach programming to the most inexperienced.

This allows the construction or creation of own algorithms that allow a normal person to learn the basic fundamentals of this process. It was created in Argentina, and supports multiple programming languages, it is also free.

The best thing about this is that it prepares you for the future, because by learning to use it you will be gaining knowledge and then moving to more complex programming languages, and you can download, install and use python without problems for example, or also activate or enable javascript in any web browser , for your continuous use (there will no longer be limits for you).

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button