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
- {
- class Program
- {
- static void Main(string[] args)
- {
- int input, input2;
- while (true)
- {
- Console.ForegroundColor = ConsoleColor.White;
- input = int.Parse(Console.ReadLine());
- //input2 = int.Parse(Console.ReadLine());
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine(arrangedDigits(input).ToString());
- //Console.ReadKey();
- }
- }
- public static int power(int a)
- {
- if (a == 1)
- return 1;
- return power(a - 1) * a;
- }
- public static int digitSum(int a)
- {
- if (a < 10)
- return 1;
- return digitSum(a / 10) + 1;
- }
- public static int devide(int a, int b)
- {
- if (a <= 0)
- return 0;
- return devide(a - b, b) + 1;
- }
- public static int digits(int n, int digit)
- {
- if (n == 0)
- return 0;
- if (n % 10 == digit)
- return digits(n / 10, digit) + 1;
- else
- return digits(n / 10, digit);
- }
- public static int series(int n)
- {
- if (n <= 0)
- return 0;
- return series(n - 2) + (n - 1) * 2 + n * 4;
- }
- public static int maxDigit(int n)
- {
- if (n < 10)
- {
- return n;
- }
- int nextDigit = maxDigit(n / 10);
- if (nextDigit >= n % 10)
- return nextDigit;
- return n % 10;
- }
- public static bool arrangedDigits(int n)
- {
- if (n < 10)
- return true;
- bool result = arrangedDigits(n / 10);
- if (n % 10 >= (n / 10) % 10 && result)
- return true;
- return false;
- }
- }
- }
Add Comment
Please, Sign In to add comment