Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4.  
  5. int array[100], i, num, sumOdd;
  6. printf("Enter the numbers \n");
  7.  
  8. scanf("%d", &num);
  9.  
  10. for (i = 0; i < num; i++)
  11. {
  12. scanf("%d", &array[i]);
  13. }
  14.  
  15.  
  16. for (i = 0; i < num; i++)
  17. {
  18. if (array[i] % 2 == 0)
  19. {
  20. printf("Even numbers are %d\n", array[i]);
  21. }
  22. }
  23.  
  24.  
  25.  
  26. for (i = 0; i < num; i++)
  27. {
  28. if (array[i] % 2 != 0)
  29. num += i;
  30. {
  31. printf("The sum of odd numbers is %d.\n", sumOdd);
  32. }
  33. }
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement