Please help me with this code, its just showing me blank output.
The program is to calculate how long it will take a university to have a population of 10,000 if they start with 200
students and increase at the ratio of 20% per annum.
#include <iostream>
using namespace std;
int main ()
{
int count, p;
for(int p=200; p<=10000; p++) //where p is the population
p = 200 + ((200/100) * 20);
count += p;
Cout << count;
return 0;
}
#include <iostream>
usingnamespace std;
int main ()
{
int count=0;
int p;
for(int p=200; p<=10000; p++) //where p is the population
p = 200 + ((200/100) * 20);
count += p;
cout << count;
return 0;
}
This should Help, I re-wrote it, Let me know if it helps. You Should be able to answer this. It's basic college algebra.....I took algebra last year in college...........
#include <iostream>
usingnamespace std;
int main ()
{
int count=0;
int p =200 + ((200/100) * 20);
for(int counter=0; counter<=(10000-201); counter++)
{
p = p +200 + ((200/100) * 20);
cout << p << " ";
}
return 0;
}