62612023-11-09 20:14:46RedStarDiana and NumberscsharpForditási hiba
public class DianaAndNumbers {

    static string maximum = "-1";

    public static void Main(string[] args)
    {

        string number = Console.ReadLine();
        checkIfDividable("42");
        printDividableNumber(number);

        Console.WriteLine(maximum);
    }

    private static void printDividableNumber(string number) {
        if (checkIfDividable(number)) {
            maximum = returnBiggerNumber(number, maximum);
        }

        for (int i = 0; i < number.Length; i++) {
            if (!checkIfDividable(number[i] + "")) {
                string newNum = removeCharAt(number, i);
                if (!newNum.Equals(""))
                    printDividableNumber(newNum);
            }
        }
    }

    public static string returnBiggerNumber(string num1, string num2) {
        if (num1.Equals("-1"))
            return num2;

        if (num2.Equals("-1"))
            return num1;

        if (num1.Length > num2.Length)
            return num1;
        if (num2.Length > num1.Length) {
            return num2;
        }

        for (int i = 0; i < num1.Length; i++) {
            int n1 = int.Parse(num1[i] + "");
            int n2 = int.Parse(num2[i] + "");

            if (n1 > n2) {
                return num1;
            } else if (n2 > n1) {
                return num2;
            }
        }
        return num1;
    }

    public static string removeCharAt(string text, int index)
    {

        string newString = "";

        for (int i = 0; i < text.Length; i++) {
            if (i != index) {
                newString += text[i];
            }
        }

        return newString;
    }

    public static bool checkIfDividable(string number) {
        int remainder = 0;

        //check if the first number is not a zero
        if (number[0] == '0') {
            return false;
        }

        for (int i = 0; i < number.Length; i++) {
            if (remainder != 0)
                remainder = int.Parse(remainder + "" + number[i]) % 3;
            else
                remainder = int.Parse("" + number[i]) % 3;


        }

        return remainder == 0;
    }

}


Forditási hiba
exit status 1
Compilation failed: 2 error(s), 0 warnings