This Python program calculates the value of the expression:
y = b × sin(a)
It reads values for a and b from the user and uses the math.sin() function to compute the result.
Note: The input angle a is expected in radians.
import math
# Read inputs from user
a = float(input("Enter value for a (in radians): "))
b = float(input("Enter value for b: "))
# Calculate y = b × sin(a)
y = b * math.sin(a)
# Display result
print("\n--- Result ---")
print(f"y = {y:.4f}")
Enter value for a (in radians): 1.5708
Enter value for b: 5
--- Result ---
y = 5.0000
- The user enters values for a and b
- The program calculates sin(a) using the math module
- The result is multiplied by b to compute y
- The final output is printed with four decimal places