Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class MathExpression
- {
- static void Main()
- {
- //Telerik Academy
- //You are given the following mathematical expression: ....
- //The sin(x) is a trigonometric function that returns the sine from the angle x (measured in radians).
- //The mod operator finds the remainder of division of one number by another.
- //Here are some examples for how the mod operator should work:
- //• 5 mod 2 = 1
- //• 5.99 mod 3 = 2
- //• 6 mod 3 = 0
- //Your task is to write a computer program that calculates the result from the shown mathematical expression, depending on the values of the variables N, M and P.
- double N = double.Parse(Console.ReadLine()),
- M = double.Parse(Console.ReadLine()),
- P = double.Parse(Console.ReadLine()),
- result = 0.0,
- upperPart = 0.0,
- downPart = 0.0,
- sinPart = 0.0;
- upperPart = N * N + (1 / (M * P)) + 1337;
- downPart = N - (128.523123123d * P);
- sinPart = Math.Sin((int)M % 180); //The important part. The remainders should work as those for integers!!!
- result = upperPart / downPart + sinPart;
- Console.WriteLine("{0:F6}", result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement