Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
682 B
3
Indexable
Never
#include <stdio.h>
#include <stdlib.h>


int main() {

    int a, b, c, d;


    printf(" Please enter 4 integers:  ");
    scanf("%d%d%d%d", &a, &b, &c, &d);


    int min_odd = -1;
    if (a % 2 != 0 && (min_odd == -1 || a < min_odd)) {
        min_odd = a;
    }
    if (b % 2 != 0 && (min_odd == -1 || b < min_odd)) {
        min_odd = b;
    }
    if (c % 2 != 0 && (min_odd == -1 || c < min_odd)) {
        min_odd = c;
    }
    if (d % 2 != 0 && (min_odd == -1 || d < min_odd)) {
        min_odd = d;
    }


    if (min_odd != -1)
        printf("%d\n", min_odd);
     else
        printf("No smallest odd number.\n");


    return 0;
}