227k views
3 votes
Write a program that will print out statistics for coin tosses. the user will input either an "h" for heads or a "t"

1 Answer

4 votes
01f or(int i=0;i<TOTAL_TOSS;i++)

02 {

03 System.out.print("Toss number "+i+". Please enter h for heads, and t for tails: ");

04 toss=scan.nextInt();

05 if(toss==1)

06 {

07 HeadCount++;

08 }

09 else

10 {

11 TailsCount++;

12 }

13}


you can work with that
User Bgossit
by
6.9k points