Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication1
- {
- // В данном классе инкапсулируются статические методы
- // выполняющие простейшие операции
- static class MyMath
- {
- // Целая часть числа
- static public int round(double d)
- {
- return (int)d;
- }
- // Дробная часть числа
- static public double doub(double d)
- {
- return d - (int)d;
- }
- // Квадрат числа
- static public double sqr(double d)
- {
- return d * d;
- }
- // Квадратный корень числа
- static public double sqrt(double d)
- {
- return Math.Sqrt(d);
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Исходное число: 12.44\n\n--------------------\n");
- Console.WriteLine("Целая часть: {0}",MyMath.round(d: 12.44));
- Console.WriteLine("Дробная часть числа: {0}",MyMath.doub(d: 12.44));
- Console.WriteLine("Квадрат числа: {0:#.##}",MyMath.sqr(d: 12.44));
- Console.WriteLine("Квадратный корень числа: {0:#.###}",MyMath.sqrt(d: 12.44));
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement