{
  "format": "tokbit",
  "version": 1,
  "name": "Ring",
  "main": [
    {
      "id": "u1",
      "kind": "declare",
      "name": "outer",
      "type": "float"
    },
    {
      "id": "u2",
      "kind": "declare",
      "name": "inner",
      "type": "float"
    },
    {
      "id": "u3",
      "kind": "doWhile",
      "body": [
        {
          "id": "u4",
          "kind": "input",
          "target": "outer",
          "prompt": "Outer radius R:"
        },
        {
          "id": "u5",
          "kind": "if",
          "condition": "outer <= 0",
          "then": [
            {
              "id": "u6",
              "kind": "output",
              "values": "\"The size must be greater than 0.\""
            }
          ],
          "else": []
        }
      ],
      "condition": "outer <= 0"
    },
    {
      "id": "u7",
      "kind": "doWhile",
      "body": [
        {
          "id": "u8",
          "kind": "input",
          "target": "inner",
          "prompt": "Inner radius r:"
        },
        {
          "id": "u9",
          "kind": "if",
          "condition": "inner <= 0 or inner >= outer",
          "then": [
            {
              "id": "u10",
              "kind": "output",
              "values": "\"The inner radius must be between 0 and R.\""
            }
          ],
          "else": []
        }
      ],
      "condition": "inner <= 0 or inner >= outer",
      "comment": "The inner radius must be positive and smaller than the outer one."
    },
    {
      "id": "u11",
      "kind": "output",
      "values": "\"Area of the ring:\", round(pi * (outer ** 2 - inner ** 2), 2)",
      "comment": "A ring is the big circle without the small one: A = π · (R² − r²)."
    }
  ],
  "functions": [],
  "comment": "Solution to the task “Area of a ring”: Ask for the outer radius R and the inner radius r and compute the area of the ring A = π · (R² − r²). The inner radius must be smaller.",
  "screen": "fit"
}
