+ 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??

20th Oct 2016, 4:13 PM
Mohamed Misfar
Mohamed Misfar - avatar
6 Respuestas
+ 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; }
20th Oct 2016, 8:30 PM
Cohen Creber
Cohen Creber - avatar
+ 7
do you need only the answer or the code that counts the result?
20th Oct 2016, 7:35 PM
LyannaM
LyannaM - avatar
+ 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
20th Oct 2016, 8:37 PM
Liam
Liam - avatar
+ 1
what is psuedo-code? is that language?
13th Nov 2016, 3:49 AM
yàsh patel
yàsh patel - avatar
- 1
a._d_.y
30th Mar 2019, 2:31 AM
شخصيةة عسكريةة
شخصيةة عسكريةة - avatar
- 1
@a._d_.y
30th Mar 2019, 2:40 AM
Abn Alhuobeti