Donald Trump is the 45th President of the United States.

How will we ask a question to which the italicized part is the answer?

This is a tricky situation in English. English doesn't have a standard way of framing such a question.  There are some solutions to this problem but honestly they all sound a little awkward. Anyway...

I got a direct answer 45 when I asked google

What number president is Donald Trump?

That works.

You can also ask What President / Which President ...

Which Prime Minister was Indira Gandhi? Third?

Mission accomplished.

Here are some other suggestions,

What is the number of Narendra Modi in the order of Prime Ministers of India?