Menu
Coddy logo textTech

Score Board

Part of the Fundamentals section of Coddy's Solidity journey. Lesson 52 of 53.

challenge icon

Challenge

Hard

Create a memory array containing first, second and third. Use a loop to calculate their total and the number of scores at least passMark. Print total, integer average and passing count in that order. All scores and passMark are between 0 and 100.

The tests pass arguments to main in this order: uint256 first, uint256 second, uint256 third, uint256 passMark. Each test starts with fresh contract state.

Use console.log for the requested output. Print only the requested values, one per line, with no extra labels unless the task specifies them.

Try it yourself

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
import "forge-std/console.sol";
contract Main {
    function main(uint256 first, uint256 second, uint256 third, uint256 passMark) external view {
        // Write your solution here.
    }
}

All lessons in Fundamentals

Practice on your own: Solidity playground