program sumofpowers
c This program computes sums of powers of integers.
integer n, m
real p, sum
print *, "Enter a positive integer :"
read *, n
print *, "Enter a power p :"
read *, p
sum = 0
m = 1
do while (m .le. n)
sum = sum + m**p
m = m + 1
end do
print *
print *, "The sum of the integers to the power", p
print *, "from 1 to", n, " is", sum
print *
print *, "Bye"
end