-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyearpopulation.c
More file actions
32 lines (25 loc) · 832 Bytes
/
yearpopulation.c
File metadata and controls
32 lines (25 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include<stdio.h>
void main()
{
int year;
float a,b,c,d,e,f;
printf("Enter year:"); scanf("%d",&year);
printf("enter the population of city A:");scanf("%f", &a);
printf("enter the population of city B:");scanf("%f", &b);
printf("enter the Growth Rate of city A:");scanf("%f", &c);
printf("enter the Growth Rate of city B:");scanf("%f", &d);
printf("=================================================================\n");
printf("Year\t population A \t population B\n");
printf("=================================================================\n");
printf("\n%d\t\t%.2f\t\t%.2f",year,a,b);
for (year=year+1; a<b; year++)
{
e=c/100;
e=a*e;
a=a+e;
f=d/100;
f=b*f;
b=b+f;
printf("\n%d\t\t%.2f\t\t%.2f",year,a,b);
}
}