Write the program in pascal “find the sum of digits of an arbitrarily significant integer”. Use string

program zz1;

var s: string; // set a variable of string type

i, k: integer; // set variables of integer type

begin

write (‘enter any significant integer’);

read (s); // enter the number from the keyboard as a string

for i: = 1 to length (s) do // organize a loop in which we iterate over all characters from the first to the last

k: = k + ord (s [i]) – 48; // take a character from a string, translate it into a numeric code, subtract 48 so that the character matches the number of the character

write (‘the sum of digits of an arbitrarily significant integer =’, k);

end.



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.