So my homework is:

1. Your program will accept a sequence of positive integers (no greater than 2000000000, though your program does not need to check) until it sees an input of 100 for the second time. It will then print the number of odd numbers, even numbers and multiples of 3 entered (including 100s). Example follows:

Enter a sequence of integers (second 100 to quit)

25

36

100

20

98

200

3

86

100

Number of odd numbers is 2

Number of even numbers is 7

Number of multiples of 3 is 2

This is what I got but its not turning out the way I want to. The only part Im stuck on is how to break the loop after "the second 100" and for some reason my "mutiple of three count is always 0.

please help. Thanks in advance

.................................................. ..

.................................................. ...

------------------------------------------

------------------------------------------

hey guys, thanks for all the suggestions. i managed to get the program to break out of the loop after the "second 100." Everything seems to work fine but now my even number(which includes the 100s) is incorrect by one(ie. 8 instead of 7)

Heres my new code.

Code:#include <stdio.h> int main() { int num; int oddcount = 0; int evencount = 0; int hundredcount = 0; int multiplethreecount = 0; printf("Enter a sequence of integers(second 100 to quit)\n"); scanf("%d", &num); while (1) { if (num == 100) { hundredcount++; if (hundredcount == 2) break; } if (num%2 == 0) { evencount++; } if (num%3 == 0) multiplethreecount++; if (num%2 != 0) oddcount++; scanf("%d", &num); } evencount += hundredcount; printf("Number of odd numbers is %d \n", oddcount); printf("Number of even numbers is %d \n", evencount); printf("Number of multiples of 3 is %d \n", multiplethreecount); return 0; }