Question

You are now allowed to use the following in additional to the techniques of the previous...

You are now allowed to use the following in additional to the techniques of the previous chapters:
• for loops
• math.h and pow() function
• formatting float and double numbers
• switch statements getchar() function
• ASCII chart
• do...while loops
• break and continue statements
• Logical AND (&&), logical OR (||), logical NOT (!) operators
• Work on format style!!! Points may be deducted for code that is not properly styled.

Q5: (World Population Growth) (20 points) World population has grown considerably over the centuries.
Continued growth could eventually challenge the limits of breathable air, drinkable water, arable cropland and
other limited resources. There is evidence that growth has been slowing in recent years and that world
population could peak sometime this century, then start to decline. For this exercise, research world population
growth issues online. Be sure to investigate various viewpoints. Get estimates for the current world population
and its growth rate (the percentage by which it’s likely to increase this year). Write a program that calculates
world population growth each year for the next 75 years, using the simplifying assumption that the current
growth rate will stay constant. Print the results in a table. The first column should display the year from year 1 to
year75. The second column should display the anticipated world population at the end of that year. The third
column should display the numerical increase in the world population that would occur that year. Using your
results, determine the year in which the population would be double what itis today, if this year’s growth rate
were to persist.

(this is C programing )

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Ans: Look at the screenshots for indentation

Assuming current population = 7,794,798,739               // in 2020

growth rate = 1.05 % per year                    // in 2020

Working code:

#include <stdio.h>
#include <math.h>
int main()
{
    int flag = 0, year_with_double_popultaion=0;                                             // flag to decide when will be the population is twice
    long long population_in_2020 = 7794798739;
    long long current_population = 7794798739;                 // current population
    double percent_increase = 1.05;                            // urrent growth rate

    for(int i=1;i<=75;i++)                                    // calculating for next 75 years
    {
       long long population_nextYear = current_population + current_population*(0.0105);                          // calculating next years population
       printf("%d\t\t%lld\t\t%lld\n",i,population_nextYear,population_nextYear - current_population);             // printing year, popoulation and increase
       current_population = population_nextYear;                                                         // changing current population to next years population
     
       if(current_population >= 2*population_in_2020 && flag==0)
         {
            flag=1;
            year_with_double_popultaion = i;                              // storing the year in which population is double
         }
    }
    printf("\nThe year in which population will be double: %d\n",year_with_double_popultaion);
    return 0;
}

Screenshots:

Output:

Add a comment
Know the answer?
Add Answer to:
You are now allowed to use the following in additional to the techniques of the previous...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 5.41 exercise Visual C#:How to Program (World Population Growth) World population has grown considerably over the...

    5.41 exercise Visual C#:How to Program (World Population Growth) World population has grown considerably over the centuries. Continued growth could eventually challenge the limits of breathable air, drinkable water, arable cropland and other limited resources. There's evidence that growth has been slowing in recent years and that world population could peak sometime this century, then start to decline. For this exercise, research world population growth issues online. Be sure to investigate various viewpoints. Get estimates for the current world population...

  • Please use only C language and NOT C++ or Java You are now allowed to use...

    Please use only C language and NOT C++ or Java You are now allowed to use the following • for loops • math.h and pow() function • formatting float and double numbers • switch statements • getchar() function • ASCII chart • do…while loops • break and continue statements • Logical AND (&&), logical OR (||), logical NOT (!) operators Pythagorean triples are three positive integer numbers a, b, c that form the sides of a right triangle, such that...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT