Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- var n = int.Parse(Console.ReadLine());
- for (int i = 1; i <= n; i++)
- {
- DivBySeven(i);
- Even(i);
- Palindrom(i);
- if (Palindrom(i) && DivBySeven(i) &&Even(i))
- {
- Console.WriteLine(i);
- }
- }
- }
- public static bool Palindrom(int i)
- {
- var temp = 0;
- var digit = 0;
- var check = false;
- var res = i;
- //
- while (i > 0)
- {
- digit = i % 10;
- temp = temp * 10 + digit;
- i = i / 10;
- }
- if (res == temp)
- {
- check = true;
- }
- return check;
- }
- public static bool Even(int i)
- {
- var temp = 0;
- var check = false;
- var res = i;
- while (i > 0)
- {
- temp = i % 10;
- if (temp % 2 == 0)
- {
- check = true;
- break;
- }
- i /= 10;
- }
- return check;
- }
- public static bool DivBySeven(int i)
- {
- var temp = 0;
- var sum = 0;
- var res = i;
- var ch = false;
- while (i>0)
- {
- temp = i % 10;
- sum += temp;
- i /= 10;
- }
- if (sum % 7 == 0)
- {
- ch = true;
- }
- return ch;
- }
- private static void GeometryCalc()
- {
- var type = Console.ReadLine().ToLower();
- //
- string[] arr = { "triangle", "square", "rectangle", "circle" };
- for (int i = 0; i < arr.Length; i++)
- {
- if (type == arr[0])
- {
- var a = double.Parse(Console.ReadLine());
- var h = double.Parse(Console.ReadLine());
- var prt = Triangle(a, h);
- Console.WriteLine($"{prt:f2}");
- break;
- }
- else if (type == arr[1])
- {
- var a = double.Parse(Console.ReadLine());
- var prt = Square(a);
- Console.WriteLine($"{prt:f2}");
- break;
- }
- else if (type == arr[2])
- {
- var a = double.Parse(Console.ReadLine());
- var b = double.Parse(Console.ReadLine());
- var prt = Rectangle(a, b);
- Console.WriteLine($"{prt:f2}");
- break;
- }
- else if (type == arr[3])
- {
- var r = double.Parse(Console.ReadLine());
- var prt = Circle(r);
- Console.WriteLine($"{prt:f2}");
- break;
- }
- }
- }
- public static double Circle(double r)
- {
- var area = Math.PI * Math.Pow(r, 2);
- return area;
- }
- public static double Square(double a)
- {
- var area = a * a;
- return area;
- }
- public static double Rectangle(double a, double b)
- {
- var area = a * b;
- return area;
- }
- public static double Triangle(double a, double h)
- {
- var area = a*h/2;
- return area;
- }
- private static void CubeProperty()
- {
- double n = double.Parse(Console.ReadLine());
- string pro = Console.ReadLine();
- //
- if (pro == "face")
- {
- var prt = Face(n);
- Console.WriteLine($"{prt:f2}");
- }
- else if (pro == "space")
- {
- var prt = Space(n);
- Console.WriteLine($"{prt:f2}");
- }
- else if (pro == "volume")
- {
- Console.WriteLine($"{Volume(n):f2}");
- }
- else if (pro == "area")
- {
- var prt = Surface(n);
- Console.WriteLine($"{prt:f2}");
- }
- }
- public static double Space(double n)
- {
- var calc = 3 * Math.Pow(n, 2);
- var prt = Math.Sqrt(calc);
- return prt;
- }
- public static double Face(double n)
- {
- var calc = 2 * Math.Pow(n, 2);
- var prt = Math.Sqrt(calc);
- return prt;
- }
- public static double Volume(double n)
- {
- var volu = Math.Pow(n, 3);
- return volu;
- }
- public static double Surface(double n)
- {
- var face = 6*Math.Pow(n,2);
- return face;
- }
- private static void CenterPoints()
- {
- int x1 = int.Parse(Console.ReadLine());
- int y1 = int.Parse(Console.ReadLine());
- int x2 = int.Parse(Console.ReadLine());
- int y2 = int.Parse(Console.ReadLine());
- //
- Check(x1, y1, x2, y2);
- }
- public static void Check(int x1, int y1, int x2, int y2)
- {
- var xDist = 0;
- var yDist = 0;
- var x = 0;
- var y = 0;
- if (x1 >= x2)
- {
- xDist = x1 - x2;
- x = x2;
- }
- else if (x1 < x2)
- {
- xDist = x2 - x1;
- x = x1;
- }
- if (y1 >= y2)
- {
- yDist = y1 - y2;
- y = y2;
- }
- else if (y1 < y2)
- {
- yDist = y2 - y1;
- y = y1;
- }
- Console.WriteLine($"({x}, {y})");
- }
- public static void Print(int num)
- {
- string prt = "";
- string[] digitsWord = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" };
- prt = digitsWord[LastDigit(num)];
- Console.WriteLine(prt);
- }
- public static int LastDigit(int num)
- {
- int last = num % 10;
- return last;
- }
- private static void Gretaer()
- {
- int a = int.Parse(Console.ReadLine());
- int b = int.Parse(Console.ReadLine());
- int c = int.Parse(Console.ReadLine());
- //
- var greatest = 0;
- if (Max(a, b) > c)
- {
- greatest = Max(a, b);
- }
- else
- {
- greatest = c;
- }
- Console.WriteLine(greatest);
- }
- public static int Max(int a, int b)
- {
- int greater = 0;
- if (a>b)
- {
- greater = a;
- }
- else
- {
- greater = b;
- }
- return greater;
- }
- public static void Greeting(string name)
- {
- Console.WriteLine($"Hello, {name}!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement