Help with while fuction

When I run this program the while loop doesn't seem to trigger and the program just stalls, what am I doing wrong? I am using Microsoft visual studio 2012.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>

int main()
{
int num;
int sides;
printf("How many dice do you want to roll?\nEnter a number between 1-10: ");
scanf_s("%d",&num);
printf("\nHow many sides on each dice?\nEnter a number between 1 - 20: ");
scanf_s("%d",&sides);
printf("\nTest input");

int rolnum = 1;
int result;
printf("\nTest variables");
while  (rolnum <= num);
{
	printf("\nTest condition");
	result = rand()%sides;
	printf("\nTest random");
	printf("\nDice %d: %d",rolnum,result);
	result++;
}
}
where does the program stall before the loop? or are you saying it stalls in the loop, because you're increasing result instead of rolnum meaning the loop will never finish.
First of all after the while statement you placed a semicolon.

while (rolnum <= num);

However in any case the loop will be infinite provided that rolnum <= num because neither rolnum nor num are being changed in the loop.
Thank you guys, the program obviously has other issues but at least i can get the thing to run as expected!
Topic archived. No new replies allowed.