Create a program for calculating the power of the number A with a natural exponent N.
September 28, 2021 | education
| Let’s compose the code of the given program:
program stepen;
var a, n: integer;
x: real;
begin
writeln (‘Enter any number a =’);
readln (a);
writeln (‘Enter a natural number of the power of number a’);
readln (n);
x: = a ^ n;
writeln (‘The result is a to the degree n =’, x);
end.
Let’s check the work of the program:
After starting, the screen will display:
Enter any number a =
Enter 7 and press Enter.
Enter a natural number of a power of a
Enter 2 and press Enter.
The screen will display:
The result is a to the power n = 49.
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.