You are on page 1of 1

#include "stdafx.

h"
#include "stdio.h"
#include "conio.h"
#include "stdlib.h"
#include "time.h"
int main()
{
int a; int l, n, s;
int max = 0; int k;
srand(time(NULL));
for (n = 1; n <= 4; n++){
s = 0;
printf("Nguoi choi %d\n", n);
for (l = 1; l <= 3; l++){
a = 1 + (rand() % 6);
printf("Ket qua lan %d: %d\n", l, a);
s = s + a;
}
printf("Tong diem: %d\n", s);
if (s > max){
max = s;
k = n;
}//if
}//for 4 nguoi choi
printf("Nguoi choi %d ", k);
printf("Thang cuoc voi so diem %d", max);
getch();
return 0;
}

You might also like