Archive | Pascal RSS feed for this section

Pascal: Calculating darts result

I believe that all of us seen or maybe even played darts. Everyone knows the circles which are numbered with points which you get by throwing the arrow. How could we calculate the result of our game if we get 10 points by hitting the center and then a minus one on each other circle on the darts board. And if we do not hit the board, we do not get any points which simply corresponds to zero.

Read More…

Pascal: Armstrong numbers

Before going straight to programming we should analyze  some different types of numbers.

The first one which I am introducing to you here is the Armstrong number. An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, we could take 153 = 1^3 + 5^3 +3^3. There some other numbers which are written down at the bottom of post.

Read More…

Pascal: Working with fractures

I was really disappointed of the lack of information about Pascal. I know that it is not very popular language now and there are many better languages around us. However, I do believe that many people need information and examples of Pascal tasks. Moreover, there are still some schools where students learn this language as their first programming experience.

Today I will try to introduce you with some fractures and how to divide them properly in Pascal.So the main point is to add some fractures and then get integer part and a new adjusted fracture.

Read More…

Pascal: Greatest common divider

I often used this function – a simple and clear to understand algorithm to find the greatest common divider of two numbers. Here is the whole code for that:

I bet there’s no better way to do this on Pascal.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.