Program: 116
Population of a town today is 100000. The population has increased steadily at the rate of 10% per year for last 10 years. Write a c program to determine the population at the end of each year in the last decade.
#include<stdio.h> #include<conio.h> int main() { int i; float pop=100000; //for-loop for 10 years for(i=1;i<=10;i++) { pop = pop - pop*0.1; //10 % of population printf("%d year: %d\n",i, (int)pop); } }
Output:
1 year: 90000 2 year: 81000 3 year: 72900 4 year: 65610 5 year: 59049 6 year: 53144 7 year: 47829 8 year: 43046 9 year: 38742 10 year: 34867
Leave a Comment