Distribution of Fix numbers
Alright, so what I'm trying to do is write a code that distributes 500 votes among 3 candidates. How am I supposed 2 do that.
I tried distributing random numbers among 3 but that didn't worked well, well not the way I thought it would.
Code:
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main (void)
{
int n1 = 0, n2 = 0, votes = 500;
srandom( (unsigned) time(NULL) );
n1 = random( ) % votes ;
n2 = random( ) % votes ;
printf("\nNumber 1 Number 2\n");
printf("\n%d %d\n", n1, n2);
return (0);
}
Well the program is just a draft I tried, but.... So any help.