watshamacalit
Programmer
Write a program that rolls a six-sided die 6000 times and displays the
number of times each face was rolled.
so far i have...
#include <stdio.h>
void main ( void )
{
int index, count, roll ;
int face[ 6 ] ;
for ( index = 1 ; index <= 5 ; index++ )
face[ index ] = 0 ;
printf( "Face\tFrequency\n" ) ;
printf( "----\t---------\n" ) ;
for ( roll = 0 ; roll <= 10 ; roll++ )
++face[ roll ] ;
for ( count = 1 ; count <= 6 ; count++ )
printf( "%4i\t%9i\n", count, face[ index ] ) ;
}
this doesnt work... the compiler says it has created a fatal error... whats wrong with the program?
number of times each face was rolled.
so far i have...
#include <stdio.h>
void main ( void )
{
int index, count, roll ;
int face[ 6 ] ;
for ( index = 1 ; index <= 5 ; index++ )
face[ index ] = 0 ;
printf( "Face\tFrequency\n" ) ;
printf( "----\t---------\n" ) ;
for ( roll = 0 ; roll <= 10 ; roll++ )
++face[ roll ] ;
for ( count = 1 ; count <= 6 ; count++ )
printf( "%4i\t%9i\n", count, face[ index ] ) ;
}
this doesnt work... the compiler says it has created a fatal error... whats wrong with the program?