Does the Buddha knew that he will be going to pass away in 3 months time when eating Cunda's meal offered to him?
Yes, the Buddha made this announcement.
63. Then the Blessed One said to the bhikkhus: "So, bhikkhus, I exhort you: All compounded things are subject to vanish. Strive with earnestness. The time of the Tathagata's Parinibbana is near. Three months hence the Tathagata will utterly pass away."
Actually not only Buddha can foretell his death - many seasoned practitioners and masters also foretold their death time.
did the Buddha hinted to Ananda 3 times, that the Buddha can live for a longer time, but Ananda was distracted and did not request the Buddha to stay?
Originally posted by Rooney9:did the Buddha hinted to Ananda 3 times, that the Buddha can live for a longer time, but Ananda was distracted and did not request the Buddha to stay?
Yes..
Originally posted by An Eternal Now:Yes..
but why did the Buddha need to ask Ananda when he can live longer and teach the dhamma longer for the sake of sentient beings in the future?
btw can u change from mean to meal, tks.
Originally posted by Rooney9:but why did the Buddha need to ask Ananda when he can live longer and teach the dhamma longer for the sake of sentient beings in the future?
He perceives he has already completed his goal of creating a sangha and disseminating the core teachings that lead to liberation.
There was a time when he hinted to Ananda that he could live longer, but since Ananda didn't request, the Buddha decided his own time of death and that became irresvirsible.