Help with C# (Math Question)

Hi, can you help me to solve this question? I want to find a solution with console application.
“Find palindromic numbers that are the product of two three-digit numbers.
As an example : 101x161 = 16261, 924x962 = 888888”
Thanks to everyone!

1 Like

Hi and welcome to the forum.

What have you tried so far?


Thank youu! I think I have a problem with the method right? In if blocks I couldn’t do the math :smile: (I’m a beginner, so my code can be bad sorry for this)
This is the code :

namespace secondtry
    class Program
        static void Main(string[] args)

            for (int num1 = 100; num1 < 1000; num1++)
                for (int num2 = 100;  num2 < 1000; num2++)
                    Checker(num1, num2);
            int Checker(int num1, int num2)
                int result = num1 * num2;
                int result1 = result / 10;
                int result2 = result1 / 10;
                if (result / 10000 == result % 10 && (result / 1000) % 10 == result1 % 10 && (result / 100) % 10 == result2 % 10)
                    Console.WriteLine("{0} * {1} = {2}", num1, num2, result);
                    Console.WriteLine("This is a palindromik number : {0}", result);
                return result;

Thanks for your help!

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

1 Like

I am really sorry, I didn’t know that! Thank you, I will be more careful next time!

So, your palindrome check is not quite right.

If your number was a string, how could you use the length of the string and indexing to check if the first and last number were the same?

2 numbers are int and result is an int? Am I wrong?

I don’t think my question was very clear.


let word = "abcba";

how do you check if it is a palindrome?

I am sorry I don’t know. I’m new in coding maybe I should look up from the Internet :confused:

Don’t worry about the code yet. If you, a human, where going to check, what would you do?

Well, I would look first char and last char. And I would continue like this. Thanks for your help, I solved it by the way. In my first message Checker method works for only 5 digit numbers, I made some changes and now it works for 6 digit numbers too! Thanks for your support!

1 Like