codeC

aaaaaaaa
mail@pastecode.io avatar
unknown
abc
4 years ago
522 B
6
Indexable
Never
#include <stdio.h>
int main() {
    int min, max;
    float tong = 0, bienDem = 0, trungBinh = 0;
    printf("Moi nhap min: \n");
    scanf("%d", &min);
    printf("Moi nhap max: ");
    scanf("%d", &max);
    int i = min;
    while (i <= max) {
        if (i % 2 == 0) {
            tong += i;
            bienDem++;
            i+=2;
        }
    }
    trungBinh = tong / bienDem;
    printf("trung binh tong cac so tu nhien chia het cho 2 tu %d den %d la : %f", min, max, trungBinh);
    return 0;
}