I am not getting the required output. This is the required output: How many jack
ID: 3641484 • Letter: I
Question
I am not getting the required output.This is the required output:
How many jackalopes do you have?
How many generations do you want to wait?
If you start with 200 jackalopes and wait 1 generations,
you will end up with a total of 204 jackalopes.
This is what I have:
#include<iostream>
using namespace std;
int main()
{
const int BIRTHRATE=3;
const int DEATHRATE=1;
int nb,nd,c=0,ng,jn;
cout<<"How many jackalopes do you have? ";
cin>>jn;
cout<<"How many generations do you want to wait? ";
cin>>ng;
while(ng!=0)
{
nb=jn*BIRTHRATE/100;
nd=jn*DEATHRATE/100;
jn=jn+nb-nd;
c++;
ng--;
}
cout<<"If you start with " << jn << "and wait " << c << "generations, you will end up witha total of " << nb << "jackalopes. ";
}