Wednesday, March 14, 2012

World Population Growth Calculator

Reads current world population and the annual world population growth rate and computes the estimated world population after one, two,and three years.
/*
   title: WorldPopulationGrowthCalculator
   author: aeriqusyairi
   date: dec30 2011
*/
#include<stdio.h>
#include<stdlib.h>

int main(){
   int i=1;
   double a=0,b=0;
   printf("Input the current world population: ");    
   scanf("%lf", &a);
   printf("Input the annual world population growth rate: ");
   scanf("%lf", &b);
   
   while(i <= 3){
      a *= b;
      printf("The estimate world population after %d year is %lf.\n",i,a);   
      i++;        
   }
   
   system("pause");
   return 0;
}

No comments:

Post a Comment