Untitled
public text v1 · immutable#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);