while (summan >= k){
You set summan to be zero and I assume that k is something positive. Then how is it possible for 0(summan) to be greater then k ?
Also this is redundant: summan = summan ++; Try this: summan += 1; Or this: summan++;
javaAddict
Nearly a Senior Poster
3,338 posts since Dec 2007
Reputation Points: 1,014
Solved Threads: 450
Skill Endorsements: 7
It the same problem I explained to another post. When you divide an int with an int, you get an int:
int ettor = (int) a/k*100;
a, k, 100 are ints, so the result would be int:
int/int = int
3/5 = 0 (not 0.6)
10/4 = 2 (not 2.5)
So it is better to do this:
int ettor = (int) (1.0*a/k*100);
// or
int ettor = (int) (100.0*a/k);
// or
double ettor = 100.0*a/k;
1.0*a/k*100
The first calculation would be: 1.0*a, double * int which will result to a double so then you will do double/k which will again be double
javaAddict
Nearly a Senior Poster
3,338 posts since Dec 2007
Reputation Points: 1,014
Solved Threads: 450
Skill Endorsements: 7