{
  "format": "tokbit",
  "version": 1,
  "name": "Sum of even numbers",
  "main": [
    {
      "id": "u1",
      "kind": "declare",
      "name": "n",
      "type": "int"
    },
    {
      "id": "u2",
      "kind": "input",
      "target": "n",
      "prompt": "Up to which number?"
    },
    {
      "id": "u3",
      "kind": "declare",
      "name": "total",
      "type": "int",
      "init": "0"
    },
    {
      "id": "u4",
      "kind": "for",
      "variable": "i",
      "range": "2, n + 1, 2",
      "body": [
        {
          "id": "u5",
          "kind": "assign",
          "target": "total",
          "value": "total + i"
        }
      ],
      "comment": "Step 2 from two goes through the even numbers only."
    },
    {
      "id": "u6",
      "kind": "output",
      "values": "\"The sum of even numbers up to\", n, \"is\", total"
    }
  ],
  "functions": [],
  "comment": "Solution to the task “Even numbers only”: Add up only the even numbers from 1 to n. You can use a condition in the loop, or a step in the range – try both.",
  "screen": "fit"
}
