/********************************************************************* * * Description: This program takes in 7 single digit integers, counts * the 2's and 3's, and notes which one is greater. * * * Input: 7 single digit numbers * * Output: tells whether more 2's or 3's are input, or equivalent amount * * *********************************************************************/ #include main() { int a,b,c,d,e,f,g,threes,twos; printf("Enter 7 single digit integers.\n"); /** prompts user **/ scanf("%d %d %d %d %d %d %d", &a,&b,&c,&d,&e,&f,&g); printf("[%d %d %d %d %d %d %d]\n", a,b,c,d,e,f,g); twos = 0; threes = 0; if (a==2) {twos++;} if (b==2) {twos++;} if (c==2) {twos++;} if (d==2) {twos++;} if (e==2) {twos++;} if (f==2) {twos++;} if (g==2) {twos++;} /*** counts 2's ***/ if (a==3) {threes++;} if (b==3) {threes++;} if (c==3) {threes++;} if (d==3) {threes++;} if (e==3) {threes++;} if (f==3) {threes++;} if (g==3) {threes++;} /*** counts 3's ***/ if (twos > threes) {printf("More 2's\n");} /** compares 2's and 3's **/ if (threes > twos) {printf("More 3's\n");} if (threes == twos) {printf("Equal number of 2's and 3's\n");} }