Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Problem 3 – Trapezoid
- //Write a program that prints on the console the border of a trapezoid by given number N.
- //The width of the top side of the trapezoid must be exactly N.
- //The width of the bottom side of the trapezoid must be exactly 2 * N.
- //The height of the trapezoid must be exactly N + 1.
- //Also the top right and the bottom right angle of the trapezoid must be equal to 90 degrees.
- //See the examples bellow.
- //Input
- //The input data is being read from the console.
- //On the only line in the console you are given an integer number N, showing the width of the smallest trapezoid side.
- //The input data will always be valid and in the format described. There is no need to check it explicitly.
- //Output
- //The output data must be printed on the console.
- //You must write the border of the described trapezoid on the console.
- //Use the symbol “*” (asterisk) to mark the border of the trapezoid.
- //Use the symbol “.” (dot) to illustrate the empty spaces outside and inside the trapezoid.
- //Constraints
- //• The number N is a positive integer between 3 and 39, inclusive.
- //• Allowed working time for your program: 0.25 seconds.
- //• Allowed memory: 16 MB.
- using System;
- class Program
- {
- static void Main()
- {
- decimal n = decimal.Parse(Console.ReadLine());
- decimal m = decimal.Parse(Console.ReadLine());
- decimal p = decimal.Parse(Console.ReadLine());
- double mod = Math.Truncate((double)m % 180);
- decimal first = (n*n) + (1/ (m*p) + 1337);
- decimal second = n - (128.523123123M * p);
- decimal third = (decimal)Math.Sin(mod);
- Console.WriteLine(Math.Round(((first/second) + third), 6));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment