The country A has 50M inhabitats and its population grows 3% per year. The country B, 70M and grows 2% per year.The above is just a sample- see input and output. Tell, in how many years A will surpass B.
Input method: get integer value and print integer value. How many years A surpasses B.
A=int(input("Enter the population of city A: ")) B=int(input("Enter the population of city B: ")) years=0 while(A<=B): A=(A*0.03)+A B=(B*0.02)+B years+=1 print("A will surpass B in {} years".format(years))
Sample Input’s..?
Input_1:
Enter the population of city A: 50000000 #(50 Million)
Enter the population of city B: 70000000 #(70 Million)
Output:
A will surpass B in 35 years
Input_2:
Enter the population of city A: 10000
Enter the population of city B: 20000
Output:
A will surpass B in 72 years
exec. on terminal
Output Video here ?
More Codes to Fcuk
- Alphabet pyramid
- Find prime numbers between lower and upper ranges
- Prime Factor
- Find the sum of positive even numbers
- An integer interval [a,b], Find the minimum size of a set S.
- Country A and B, how many years the population of A surpasses B.
- Identify pH level
- Find the Perfect Number
- Find out if a word is a palindrome or not
- Find next Palindrome of N number.
- The writing bot Question. A scientist has created a writing bot. Read and write activity needs to be captured.
- Total Number of Odds in the list
- Partition this string into as many parts as possible.
- Leap year
- LCM of two numbers
- Greatest of three numbers
- Find the Gravitational Force Acting Between Two Objects.
- Find the missing element in geometric progression
- Find the GCD Greatest common divisor
- convert a given float number to integer