#please help me with this

1 messages · Page 1 of 1 (latest)

cobalt bear
#

Write a C program that allows you to input 3 integers between 0 and 50, sorts these integers from smallest to largest, and displays the even numbers between the smallest and largest values.
also can some one write me an algoritme for it too pls

unborn basinBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

#

@cobalt bear

Screenshots!

Your message appears to contain screenshots but no code. Please send code and error messages in text instead of screenshots if applicable!

cobalt bear
#

#include <stdio.h>
int main () {
int a,b,c,i;
do {printf("give 3 integrants (Between 0 and 50): ");
scanf("%d %d %d",&a,&b,&c);

if (a>b) {
int temp = a;
a = b;
b = temp;
}
if (a>c) {
int temp = a;
a = c;
c = temp;
}
if (b>c) {
int temp = b;
b = c;
c = temp;
}
} while (a<0 a>50 b<0 b>50 c<0 || c>50);
for (i=c;i<=a;i++) {
if (i%2==0) {
printf("%d",i);

}

}

return 0;
}

dense basalt
#

#1013104018739974194

#

also can some one write me an algoritme for it too pls
no one is going to wriite code for you either

outer garden
cobalt bear
#

#include <stdio.h>

int main() {
int a, b, c, temp, min, max, i;

do {
    printf("Entrez 3 entiers (entre 0 et 50) : ");
    scanf("%d %d %d", &a, &b, &c);

    if (a > b) {
        temp = a;
        a = b;
        b = temp;
    }
    if (a > c) {
        temp = a;
        a = c;
        c = temp;
    }
    if (b > c) {
        temp = b;
        b = c;
        c = temp;
    }
} while (a < 0 || a > 50 || b < 0 || b > 50 || c < 0 || c > 50);

min = a;
max = c;

printf("Les entiers triés sont : %d, %d, %d\n", a, b, c);
printf("Les entiers pairs entre %d et %d sont :\n", min, max);

for (i = min; i <= max; i++) {
    if (i % 2 == 0) {
        printf("%d\n", i);
    }
}

return 0;

}

#

I did this and it worked fine

#

I also did it with if but that way boring so I just stuck to this format