+ 3
Country A's population is 50 million and growth rate is 3% And Country B's population is 70 million and growth rate is 2%. In how many years Country A surpass Country B??
6 odpowiedzi
+ 9
#include <iostream>
using namespace std;
int main()
{
double a = 50000000, b = 70000000;
short int years = 0;
while (b > a)
{
a *= 1.03;
b *= 1.02;
years++;
}
cout << years << " years";
return 0;
}
+ 7
do you need only the answer or the code that counts the result?
+ 2
In psuedo-code:
Create variables for:
years (int)
country A's population (double)
country B's population (double)
WHILE (countryBPop > countryAPop) {
countryAPop * 1.03
countryBPop * 1.02
years++
}
Output years
+ 1
what is psuedo-code? is that language?
- 1
a._d_.y
- 1
@a._d_.y