fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int arr[7]={1,3,5,7,11,13,15};
  5.  
  6. int odd=0;
  7. int even=0;
  8. for(int i=0;i<7;i++){
  9. if(i%2==0) even+=arr[i];
  10. else odd+=arr[i];
  11. }
  12. printf(" Even:%d",even);
  13. printf("Odd:%d",odd);
  14.  
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0.01s 5308KB
stdin
Standard input is empty
stdout
 Even:32Odd:23