Is there something wrong with the following solution to the "Bytelandian gold coins" problem.

Okay, so here’s my solution to the “Bytelandian gold coins” problem.

#include <iostream>

using namespace std;

int main()
	unsigned int n;
	unsigned int n_dollars;

	int i = 0;
	while(i < 8)
		cin >> n;

		if(n>=1000000000 || n<=0)break;

		n_dollars = (13 * n)/12;
		cout << n_dollars << endl << endl;

	return 0;

But when I submit this program, it says “Time Limit Exceeded”. Clearly the above solution does work fine. And I think that this solution is pretty fast. Is there something wrong with my solution or isn’t there ?

Thanks, Best Regards !

Have a look at this i just entered 2 numbers in the input and it printed so many outputs.

Also the output was not formatted as required.
Before discussing this question, i would suggest that you first have a look at these:

@pravinda333 you have not incremented your variable i which is why your code never exits the while loop.