19.4k views
0 votes
The world population reached 7 billion people on October 21, 2011, and was growing at the rate of 1.1% each year. Assuming that the population continues to grow at the same rate, approximately when will the population reach 8 billion? Please note that this program requires you to construct a loop that repeats through the years until the population reaches 8 billion people

1 Answer

5 votes

Answer:

// Program is written in C++ Programming Language.

// Comments are used for explanatory purpose

#include<iostream>

using namespace std;

int main()

{

// Declare and Initialise Variables

int year = 2011;

float rate = 0.011;// 1.1%

double population = 7000000000;

// Iterate through years to get number of years

// Population will get to 8 billion

while(population<8000000000)

{

// Calculate new population

population = population * ( 1 + rate);

// Population = Population * Population * Rate

year++;

}

//End loop

// Print Population and Year

cout<<"Population in "<<year<<" is "<<population;

}

return 0;

}

User Dylanvanw
by
4.4k points