Only use srand(time(NULL)) once (i.e put it at the start of int main()). If you are doing it in the loop, then you are seeding your random number generator with the same input (time which is not really changing at this rate) over and over. That means you will get the same output over and over.
I would replace lines 9-12 with this:
1 2
|
srand(time(NULL));
x = ((rand()%6)+5)*5);
|
rand%6 is used because you want 6 discrete values. (0,1,2,3,4,5)
I then translate it up 5 to get (5,6,7,8,9,10)
and then multiply by 5 to get (25, 30, 35, 40, 45, 50)
If you are specifically asking about
your particular exit condition from the loop (which is a valid yet ineffecient method of doing this), listen to what
Athar said. Replace the line:
}while(x!=25||x!=30||x!=35||x!=40||x!=45||x!=50);
with
}while(!(x==25||x==30||x==35||x==40||x==45||x==50));
Check out DeMorgan for more information about boolean algebra like this.