I had to do this algorithm:
In 2010, a small Brazilian city has 20,000 inhabitants. The forecast of IBGE is that this city grows at a rate of 5% per year. Knowing addition, make an algorithm that prints on the screen the year and population planned for the city in such a year, with the year varying from 2011 to 2030.
using the for
and I did this algorithm:
float populacao;
int conta,taxa,total;
populacao=20.000;
taxa=1.05;
for (conta=2011;conta<=2030;conta++)
{
total=populacao*taxa;
populacao=total;
printf("O ano de %d tera %f de habitantes \n",conta,populacao);
}
But the result of the population is giving 20.000000
to all the years, what is wrong?