# In pascal Create a program that for an arbitrary natural four-digit number determines the sum

**In pascal Create a program that for an arbitrary natural four-digit number determines the sum and the product of its digits.**

Since we know the number of digits in a number in advance, we don’t have to translate this number into a string and separate it by symbols to determine which digits the original number consists of.

You can sequentially divide this number by digits and find the integer part of the division.

To find the first digit, we will need to divide the number by a thousand and fix the integer part of the division:

n1: = chisl div 1000;

If the number was, for example, 4521, then n1 will be equal to 4.

To find the second digit, we will need to divide the number by one hundred and fix the integer part of the division:

n2: = chisl mod 1000 div 100;

For our example, n2 becomes 5.

To find the third digit, we will need to divide the number by ten and fix the integer part of the division:

n3: = chisl mod 1000 mod 100 div 10;

For our example, n3 becomes 2.

Let’s find the fourth digit:

n4: = n3 mod 10;

sum: = n1 + n2 + n3 + n4;