WPM0
WPM0
דיוק100%
נפילה0s
זמן הזמן—
דמויות0
תיקון0
טעויות0
התקדמות התקדמות0%
Caps Lock פעיל

תגית: Code Direct Guide

תכנות שפה
Rust
קושי
בינוני בינוני בינוני

Filter even values, square them, and calculate the sum.

fn main() {
    let values = [1, 2, 3, 4, 5, 6];

    let total: i32 = values
        .iter()
        .filter(|value| **value % 2 == 0)
        .map(|value| value * value)
        .sum();

    println!("{total}");
}