Write a program that takes a number and returns zero if the number is even and the number
August 8, 2021 | education
| Write a program that takes a number and returns zero if the number is even and the number itself if it is odd. Pascal
Program chislo;
Var
a: integer;
Begin
writeln (‘Enter a number’); {Displays the phrase ‘Enter a number’}
readln (a); {Reading the number a from the keyboard}
if a mod 2 = 0 then writeln (0) {If the remainder of dividing a number by 2 is equal to zero, then the number 0 is displayed on the screen}
else {Otherwise, that is, if the division condition is not met}
writeln (a); {Displaying the number a}
end.
{} – In the Pascal programming language – ‘comment’. The text written inside the curly braces is not readable by the computer.
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.