Untitled

mail@pastecode.io avatar
unknown
c_cpp
8 months ago
478 B
7
Indexable
Never
#include <stdio.h>

int a, b, c, d;

int main () {
    scanf("%d %d %d %d", &a, &b, &c, &d);
    int oddSum = 0, evenSum = 0;
    
    if (a % 2 == 0) evenSum += a;
    else oddSum += a;
    
    if (b % 2 == 0) evenSum += b;
    else oddSum += b;
    
    if (c % 2 == 0) evenSum += c;
    else oddSum += c;
    
    if (d % 2 == 0) evenSum += d;
    else oddSum += d;
    
    printf("sum of odd number is %d", oddSum);
     printf("sum of even number is %d", evenSum);
    
}
Leave a Comment