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.
#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.