All pastes #762580 Raw Edit

Untitled

public text v1 · immutable
·published 2007-11-05 19:45 UTC
rendered paste body
#include<stdio.h>
#include<stdlib.h>
#include<time.h>

int main (void)
{
int i;
int seen[5];
int store[5];
int tot;
int rand;

srand((unsigned) time(NULL));

while(tot < 5)
for (i = 0; i < 5; i++)
rand = rand() % 5 + 1;
if (seen[rand] == 0) {
store[i] = rand;
seen[rand] = 1;
tot += seen[rand];
}

for (i = 0; i < 5; i ++) {
if (store[rand] == i % 5 + 1)
	tot2++;

printf("%d", tot2);