Ad

Chapter - 4: The Loop Control Structure

The population of a town today is 100,000. The population has increased steadily at the rate of 10% per year for the last 10 years. Write a program to determine the population at the end of each year last decade.


Ad
E
Sections
14
Exercises
#include<stdio.h>
#include<conio.h>

int main()
{
	int pop = 100000;

	for (int i = 0; i < 10; i++)
	{
		pop -= (pop / 100) * 10;
		printf("Year %d : %d\n", 10-i, pop );
	}
	getch();
	return 0;
}
Ad

© 2024 Garbage Valuegarbage value logo