Fasting and prayer are both to be done in private and they go with each other. It is not something to be done to boaster our status with men.
There was time for public prayer and fasting for God's people.
1 Kings 21:9 In those letters she wrote: "Proclaim a day of fasting and seat Naboth in a prominent place among the people.
Jeremiah 36:9 In the ninth month of the fifth year of Jehoiakim son of Josiah king of Judah, a time of fasting before the LORD was proclaimed for all the people in Jerusalem and those who had come from the towns of Judah.