Question

In: Electrical Engineering

The population of a town A is less than the population of town B. However, the...

The population of a town A is less than the population of town B. However, the population of town A is growing faster than the population of town B. Write a program that prompts the user to enter the population and growth rate of each town. The program outputs after how many years the population of town A will be greater than or equal to the population of town B and the populations of both the towns at that time. (A sample input is: Population of town A = 5000, growth rate of town A = 4%, population of town B = 8000, and growth rate of town B =2%.)

Hint: The population can be calculated as the following:

,??-????????????.=,??-??????????????.?(1+??????????? ????????/100.0)

Solutions

Expert Solution

here iam attached c language code and simulation results

#include<stdio.h>
main()
{
int pa,pb,pga,pgb; // declarations of intiger variables
int a,b,c=0;
printf("Note1 : papulation of town A less than town B\n");
printf("Note2: papulation of growth rate of town A gretter than town B\n");
printf("enter papulation of town A:");
scanf("%d",&pa);
printf("enter growth rzte of town A: EX: 2 any intiger value ");
scanf("%d",&pga);
printf("enter papulation of town B :");
scanf("%d",&pb);
printf("enter growth rzte of town B: EX 2 intiger any rate value ");
scanf("%d",&pgb);
pga=pga*100; // growth rate converted to percentage
pgb=pgb*100; // growth rate converted to percentage
while(1) // infinate loop
{
a=pa*(1+pga/100); // calculate new papulation
b=pb*(1+pgb/100); // calculate new papulation
c=c+1; // count number of years
if (a>=b)
break;
else
{
pa=a;
pb=b;
}


}
  
  
printf(" number of years papulation of town a gretter than equal to town b : %d",c);
getch();
}


Related Solutions

C++ Instructions The population of town A is less than the population of town B. However,...
C++ Instructions The population of town A is less than the population of town B. However, the population of town A is growing faster than the population of town B. Write a program that prompts the user to enter: The population of town A The population of town B The growth rate of town A The growth rate of town B The program outputs: After how many years the population of town A will be greater than or equal to...
7) THE COSTS OF PRODUCING HATS HAVE INCREASED CONSIDERABLY, HOWEVER, THEIR EFFECT IS LESS THAN THE...
7) THE COSTS OF PRODUCING HATS HAVE INCREASED CONSIDERABLY, HOWEVER, THEIR EFFECT IS LESS THAN THE DECREASE OF TAXES FOR THE PRODUCTION OF THE SAME. Offer Increase 8) THE GOVERNMENT REDUCED TAXES FOR INDIVIDUALS, APPLIED TO THE NAME OF THESE. Demand Increases 9) COMPETITION PRICES HAVE INCREASED CONSIDERABLY, RESULTING IN AN INCREASE OF BUYERS AND THIS IN turn INCREASES THE INVENTORY MOVEMENT. HOWEVER, BUYERS 'REACTION IS GREATER THAN INVENTORY MOVEMENT. Demand Increases. Offer Increase 10) THE MANUFACTURING SECTOR OF SOLAR...
You wish to test the claim that the first population mean is less than the second...
You wish to test the claim that the first population mean is less than the second population meanat a significance level of α=0.001α=0.001.      Ho:μ1=μ2Ho:μ1=μ2 Ha:μ1<μ2Ha:μ1<μ2 You obtain the following two samples of data. Sample #1 Sample #2 43.3 56.2 64.2 49.7 95.4 61.0 85.0 49.1 50.9 49.1 61.0 63.2 72.7 81.7 41.4 55.8 54.5 83.6 93.5 79.2 74.9 77.8 49.8 48.8 43.5 90.5 90.5 76.2 47.7 What is the test statistic for this sample? test statistic =   Round to 3...
You wish to test the claim that the first population mean is less than the second...
You wish to test the claim that the first population mean is less than the second population mean at a significance level of α=0.01α=0.01.      Ho:μ1=μ2Ho:μ1=μ2 Ha:μ1<μ2Ha:μ1<μ2 You obtain the following two samples of data. Sample #1 Sample #2 71.2 85.7 85.4 76.5 92.2 81.3 72.7 71.8 86.8 78.3 86.3 78.7 80.3 72.2 93.3 83.2 86.8 85.3 81.6 80.5 87.8 88.6 75.4 What is the test statistic for this sample? test statistic = Round to 3 decimal places. What is...
You wish to test the claim that the first population mean is less than the second...
You wish to test the claim that the first population mean is less than the second population mean at a significance level of α=0.001α=0.001.      Ho:μ1=μ2Ho:μ1=μ2 Ha:μ1<μ2Ha:μ1<μ2 You obtain the following two samples of data. Sample #1 Sample #2 41.5 47.1 71.9 67.8 57.1 72.9 52.3 70.3 65.5 68.8 66.2 69.3 70.4 87.8 79.7 89.4 81.0 70.4 71.4 68.8 91.6 82.1 79.1 What is the test statistic for this sample? test statistic =  Round to 4 decimal places. What is the...
You wish to test the claim that the first population mean is less than the second...
You wish to test the claim that the first population mean is less than the second population mean at a significance level of α=0.01α=0.01.      Ho:μ1=μ2Ho:μ1=μ2 Ha:μ1<μ2Ha:μ1<μ2 You obtain the following two samples of data. Sample #1 Sample #2 71.2 85.7 85.4 76.5 92.2 81.3 72.7 71.8 86.8 78.3 86.3 78.7 80.3 72.2 93.3 83.2 86.8 85.3 81.6 80.5 87.8 88.6 75.4 What is the test statistic for this sample? test statistic = Round to 3 decimal places. What is...
You wish to test the claim that the first population mean is less than the second...
You wish to test the claim that the first population mean is less than the second population mean at a significance level of α=0.02α=0.02.      Ho:μ1=μ2Ho:μ1=μ2 Ha:μ1<μ2Ha:μ1<μ2 You obtain the following two samples of data. Sample #1 Sample #2 72.8 86.5 83.4 79.7 88.0 76.7 86.5 87.5 93.6 91.3 82.0 78.6 92.7 89.2 95.0 63.1 82.9 82.0 104.1 75.4 84.2 98.6 60.6 76.4 85.9 83.7 75.9 74.8 What is the test statistic for this sample? test statistic =  Round to 3...
You wish to test the claim that the first population mean is less than the second...
You wish to test the claim that the first population mean is less than the second population mean at a significance level of α=0.02α=0.02.      Ho:μ1=μ2Ho:μ1=μ2 Ha:μ1<μ2Ha:μ1<μ2 You obtain the following two samples of data. Sample #1 Sample #2 72.8 86.5 83.4 79.7 88.0 76.7 86.5 87.5 93.6 91.3 82.0 78.6 92.7 89.2 95.0 63.1 82.9 82.0 104.1 75.4 84.2 98.6 60.6 76.4 85.9 83.7 75.9 74.8 What is the test statistic for this sample? test statistic =  Round to 3...
1. Risk is a. The probability that return will be less than expected. b. The standard...
1. Risk is a. The probability that return will be less than expected. b. The standard deviation of the probability distribution of returns. c. Variability in return d. All of the above. 2. A stock with a beta of 1.0 will : a. always generate a return equal to the market average b. always generate a return that is close to the market average. c. always generate a return that is at least as the market average. d. all of...
1. A biochemistry student was culturing a population of bacteria at less than 20 degrees Celsius....
1. A biochemistry student was culturing a population of bacteria at less than 20 degrees Celsius. After some hours, the temperature was raised to 37 degrees Celsius. What would be the consequent effect of this change in the      (a) fatty acid composition of the membrane? (b) transition temperature of the lipid bilayer? 2. Cardiac glycosides are natural products that increase the intensity of heart muscle contraction. Among them are (a) digitalin – from digitalis, an extract of purple foxglove leaves...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT