Advertisement
Guest User

Untitled

a guest
Oct 30th, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <stdio.h>
  2. int main() {
  3. int a, sum = 0;
  4. int max = 100;
  5. do
  6. {
  7. do
  8. {
  9. printf("Give me EVEN NUMBER\n");
  10. } while (scanf("%d", &a) && a % 2 != 0);
  11. sum += a;
  12. if (sum<max)
  13. {
  14. do
  15. {
  16. printf("Give me ODD NUMBER\n");
  17. } while (scanf("%d", &a) && a % 2 != 1);
  18. sum += a;
  19. }
  20. } while (sum < max);
  21. printf("MAX=%d reached. The sum is %d", max, sum);
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement