For30. An integer N (> 1) and two real points on the numerical axis: A, B (A < B) are given. The segment [A, B] is divided into N equal segments. Output H - the length of each segment, and also the values of the function \(F(X) = 1 - \sin(X)\) at the points dividing the interval [A, B]:
\(F(A), F(A + H), F(A + 2 \cdot H), ... , F(B).\)

Solution in Python 3:

import random
import math

B = random.randrange(-9,11)
A = random.randrange(-10,B)
N = random.randrange(2,11)

H = (B - A) / N
print("A = ",A)
print("B = ",B)
print("N = ",N)
print("H = {0:.2f}".format(H))

x = A
for i in range(0,N+1):
y = 1 - math.sin(x)
print("{0:.2f} : {1:.4f}".format(x,y))
x += H