Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- int a, sum = 0;
- int max = 100;
- do
- {
- do
- {
- printf("Give me EVEN NUMBER\n");
- } while (scanf("%d", &a) && a % 2 != 0);
- sum += a;
- if (sum<max)
- {
- do
- {
- printf("Give me ODD NUMBER\n");
- } while (scanf("%d", &a) && a % 2 != 1);
- sum += a;
- }
- } while (sum < max);
- printf("MAX=%d reached. The sum is %d", max, sum);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement