Zar Atma

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

void zarAt(void);
void sonucYaz(void);
int zar;
int sonuc[6] = {0};
int main(int argc, char *argv[])
{
printf(“————————————————–\n”);
printf(“|          100 DEFA ZAR ATALIM                   |\n”);
printf(“————————————————–\n\n\n”);
zarAt();
system(“PAUSE”);
return 0;
}

void zarAt(void)
{
int i;
srand(time(NULL));
for(i=0; i<100;i++){
zar = 1+rand()%6;
sonuc[zar-1]++; }
sonucYaz();
}

void sonucYaz(void)
{
int i;
for(i=0; i<6; i++)
printf(“%i—%i kere geldi.\n”,i+1, sonuc[i]);
}

Yorum Yapın

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑

%d blogcu bunu beğendi: