Having a little trouble figuring this one out, I have a bunch of int variables which are generating random numbers from 1-9. I need them to generate the correct numbers to equal
Move the rand()
into the while loop, or you'll generate random numbers only once, and get stucked in while loop.
do{
int numone = rand()%10;
int numtwo = rand()%10;
int numthree = rand()%10;
int numfour = rand()%10;
int finalsum;
finalsum = numone + numtwo + numthree + numfour;
}while(finalsum !=30);