<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="category">
    <category>
      <text>$course$/top/OnlineCompiler.io C (español)</text>
    </category>
    <info format="html">
      <text><![CDATA[<p>Preguntas CodeRunner gratis de OnlineCompiler.io (https://onlinecompiler.io/es/banco-de-preguntas-coderunner), con licencia CC BY 4.0. Usan los tipos de pregunta que ya trae CodeRunner, así que funcionan en cualquier servidor Jobe.</p>]]></text>
    </info>
    <idnumber></idnumber>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Celsius a Fahrenheit]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escribe un programa que lea una temperatura en grados Celsius e imprima su valor en grados Fahrenheit, usando <i>F</i> = <i>C</i> &times; 9 / 5 + 32. Imprime el resultado con exactamente un decimal.</p><p>La entrada es un solo número real, posiblemente negativo, escrito con punto decimal (por ejemplo, <code>36.6</code>), y la salida también usa punto.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>c_program</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[#include <stdio.h>

int main(void) {
    double celsius;
    if (scanf("%lf", &celsius) == 1) {
        double fahrenheit = celsius * 9.0 / 5.0 + 32.0;
        printf("%.1f\n", fahrenheit);
    }
    return 0;
}
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[100
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[212.0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[36.6
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[97.9]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[0
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[32.0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[-40
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[-40.0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[21.5
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[70.7]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[-273.15
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[-459.7]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>c</text></tag>
      <tag><text>io</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Formatear una duración]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escribe una función <code>void print_duration(int seconds)</code> que imprima una duración dada en segundos como horas, minutos y segundos con el formato <code>H:MM:SS</code>, seguida de un salto de línea. Los minutos y los segundos siempre llevan dos dígitos; las horas usan los dígitos que hagan falta, sin ceros a la izquierda. Por ejemplo, <code>print_duration(3725)</code> imprime <code>1:02:05</code>.</p><p>0 &le; <code>seconds</code> &le; 10<sup>6</sup>. La función imprime el resultado; no devuelve nada.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>c_function</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[void print_duration(int seconds) {
    int hours = seconds / 3600;
    int minutes = seconds % 3600 / 60;
    int secs = seconds % 60;
    printf("%d:%02d:%02d\n", hours, minutes, secs);
}
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print_duration(3661)]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1:01:01]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print_duration(0)]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0:00:00]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print_duration(59)]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0:00:59]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print_duration(86399)]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[23:59:59]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print_duration(36000)]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[10:00:00]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[print_duration(1000000)]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[277:46:40]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>c</text></tag>
      <tag><text>io</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Año bisiesto]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escribe una función <code>bool is_leap_year(int year)</code> que devuelva <code>true</code> si <code>year</code> es un año bisiesto en el calendario gregoriano y <code>false</code> en caso contrario. La regla: un año divisible por 4 es bisiesto, pero un año divisible por 100 solo es bisiesto si también es divisible por 400. Así, 2000 fue bisiesto y 1900 no lo fue.</p><p>1 &le; <code>year</code> &le; 9999. <code>&lt;stdbool.h&gt;</code> ya está incluido. Las pruebas imprimen el resultado con <code>%d</code>, así que <code>true</code> se muestra como 1 y <code>false</code> como 0.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>c_function</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[bool is_leap_year(int year) {
    return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0;
}
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d\n", is_leap_year(2024))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d\n", is_leap_year(2023))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d\n", is_leap_year(1900))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d\n", is_leap_year(2000))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d\n", is_leap_year(2100))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d %d\n", is_leap_year(2400), is_leap_year(1))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1 0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>c</text></tag>
      <tag><text>conditionals</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Cuadrante de un punto]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escribe una función <code>int quadrant(int x, int y)</code> que devuelva el cuadrante del plano cartesiano donde está el punto (<i>x</i>, <i>y</i>):</p><ul><li>1 si <i>x</i> &gt; 0 y <i>y</i> &gt; 0;</li><li>2 si <i>x</i> &lt; 0 y <i>y</i> &gt; 0;</li><li>3 si <i>x</i> &lt; 0 y <i>y</i> &lt; 0;</li><li>4 si <i>x</i> &gt; 0 y <i>y</i> &lt; 0;</li><li>0 si el punto está sobre un eje (<i>x</i> o <i>y</i> vale 0), porque entonces no pertenece a ningún cuadrante.</li></ul>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>c_function</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[int quadrant(int x, int y) {
    if (x == 0 || y == 0) {
        return 0;
    }
    if (x > 0) {
        return y > 0 ? 1 : 4;
    }
    return y > 0 ? 2 : 3;
}
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d\n", quadrant(3, 4))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d\n", quadrant(-2, 5))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[2]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d\n", quadrant(-1, -1))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[3]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d\n", quadrant(7, -3))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[4]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d %d\n", quadrant(0, 5), quadrant(-4, 0))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0 0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d\n", quadrant(0, 0))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>c</text></tag>
      <tag><text>conditionals</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Contar pares e impares]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escribe un programa que lea enteros hasta el final de la entrada e imprima cuántos eran pares y cuántos impares, separados por un espacio.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>c_program</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[#include <stdio.h>

int main(void) {
    int x, even = 0, odd = 0;
    while (scanf("%d", &x) == 1) {
        if (x % 2 == 0) {
            even++;
        } else {
            odd++;
        }
    }
    printf("%d %d\n", even, odd);
    return 0;
}
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[1 2 3 4 5
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[2 3]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[-2
-3
0
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[2 1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0 0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[10 -7 13 8 100 -1
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[3 3]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>c</text></tag>
      <tag><text>loops</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Triángulo de Floyd]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escribe una función <code>void floyd(int rows)</code> que imprima el triángulo de Floyd con <code>rows</code> filas. La fila 1 tiene un número, la fila 2 tiene dos, la fila 3 tiene tres, y así sucesivamente; los números se cuentan desde 1 y continúan de una fila a la siguiente. Separa los números de una fila con un espacio y termina cada fila con un salto de línea. Por ejemplo, <code>floyd(4)</code> imprime:</p><pre>1
2 3
4 5 6
7 8 9 10</pre><p>1 &le; <code>rows</code> &le; 20. Cada llamada empieza a contar desde 1 otra vez.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>c_function</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[void floyd(int rows) {
    int next = 1;
    for (int row = 1; row <= rows; row++) {
        for (int i = 0; i < row; i++) {
            if (i > 0) {
                printf(" ");
            }
            printf("%d", next);
            next++;
        }
        printf("\n");
    }
}
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[floyd(3)]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1
2 3
4 5 6]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[floyd(1)]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[floyd(5)]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1
2 3
4 5 6
7 8 9 10
11 12 13 14 15]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[floyd(2); floyd(2)]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1
2 3
1
2 3]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[floyd(7)]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
22 23 24 25 26 27 28]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>c</text></tag>
      <tag><text>loops</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Factorial]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escribe una función <code>long long factorial(int n)</code> que devuelva <i>n</i>! para 0 &le; <i>n</i> &le; 20. Recuerda que 0! es 1.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>c_function</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[long long factorial(int n) {
    long long result = 1;
    for (int i = 2; i <= n; i++) {
        result *= i;
    }
    return result;
}
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%lld\n", factorial(5))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[120]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%lld\n", factorial(0))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%lld\n", factorial(10))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[3628800]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%lld\n", factorial(20))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[2432902008176640000]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>c</text></tag>
      <tag><text>functions</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Verificar número primo]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escribe una función <code>bool is_prime(int n)</code> que devuelva <code>true</code> si <code>n</code> es primo y <code>false</code> en caso contrario. Un número primo es un entero mayor que 1 cuyos únicos divisores positivos son 1 y él mismo; por lo tanto 0, 1 y los números negativos no son primos.</p><p>&minus;10<sup>6</sup> &le; <code>n</code> &le; 10<sup>6</sup>. Basta con probar divisores hasta la raíz cuadrada de <code>n</code>. Las pruebas imprimen el resultado con <code>%d</code> (1 para <code>true</code>, 0 para <code>false</code>).</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>c_function</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[bool is_prime(int n) {
    if (n < 2) {
        return false;
    }
    for (int d = 2; d * d <= n; d++) {
        if (n % d == 0) {
            return false;
        }
    }
    return true;
}
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d\n", is_prime(7))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d\n", is_prime(12))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d\n", is_prime(2))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d %d %d\n", is_prime(0), is_prime(1), is_prime(-7))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0 0 0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d\n", is_prime(49))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d\n", is_prime(999983))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>c</text></tag>
      <tag><text>functions</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Invertir un arreglo]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escribe una función <code>void reverse_array(int a[], int n)</code> que invierta, en el mismo arreglo, los primeros <code>n</code> elementos de <code>a</code>: el primero intercambia su lugar con el último de esos <code>n</code>, el segundo con el penúltimo, y así sucesivamente. Los elementos que están después de los primeros <code>n</code> se quedan donde están. No uses un segundo arreglo.</p><p>0 &le; <code>n</code> &le; 1000; si <code>n</code> es 0 o 1, nada cambia. La función no devuelve nada: quien la llama ve el cambio porque un parámetro de tipo arreglo se refiere al propio arreglo que se pasó en la llamada.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>c_function</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[void reverse_array(int a[], int n) {
    for (int i = 0, j = n - 1; i < j; i++, j--) {
        int tmp = a[i];
        a[i] = a[j];
        a[j] = tmp;
    }
}
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[int a[] = {1, 2, 3, 4, 5};
reverse_array(a, 5);
for (int i = 0; i < 5; i++) printf("%d ", a[i]);
printf("\n");]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[5 4 3 2 1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[int a[] = {10, 20, 30, 40};
reverse_array(a, 4);
for (int i = 0; i < 4; i++) printf("%d ", a[i]);
printf("\n");]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[40 30 20 10]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[int a[] = {7};
reverse_array(a, 1);
printf("%d\n", a[0]);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[7]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[int a[] = {-1, 0, -3, 2, 5, -6};
reverse_array(a, 6);
for (int i = 0; i < 6; i++) printf("%d ", a[i]);
printf("\n");]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[-6 5 2 -3 0 -1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[int a[] = {1, 2, 3, 4, 5};
reverse_array(a, 3);
for (int i = 0; i < 5; i++) printf("%d ", a[i]);
printf("\n");]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[3 2 1 4 5]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[int a[] = {9, 8};
reverse_array(a, 0);
printf("%d %d\n", a[0], a[1]);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[9 8]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>c</text></tag>
      <tag><text>lists</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Por encima del promedio]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escribe un programa que lea un entero <i>n</i> (1 &le; <i>n</i> &le; 1000) y luego <i>n</i> enteros, cada uno entre &minus;10<sup>6</sup> y 10<sup>6</sup>, separados por espacios o saltos de línea. Imprime cuántos de esos <i>n</i> números son estrictamente mayores que su promedio.</p><p>Necesitarás guardar los números en un arreglo, porque el promedio solo se conoce después de leerlos todos.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>c_program</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[#include <stdio.h>

int main(void) {
    int n;
    int values[1000];
    long long sum = 0;
    if (scanf("%d", &n) != 1) {
        return 0;
    }
    for (int i = 0; i < n; i++) {
        if (scanf("%d", &values[i]) != 1) {
            return 0;
        }
        sum += values[i];
    }
    double average = (double) sum / n;
    int count = 0;
    for (int i = 0; i < n; i++) {
        if (values[i] > average) {
            count++;
        }
    }
    printf("%d\n", count);
    return 0;
}
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[5
1 2 3 4 5
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[2]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[3
2 2 2
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[1
7
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[4
10
0
0
0
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[2
-1 -2
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text></text>
        </testcode>
        <stdin>
          <text><![CDATA[7
4 -6 4 4 4 4 4
]]></text>
        </stdin>
        <expected>
          <text><![CDATA[6]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>c</text></tag>
      <tag><text>lists</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Verificar palíndromo]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escribe una función <code>bool is_palindrome(const char s[])</code> que devuelva <code>true</code> si la cadena <code>s</code> se lee igual de izquierda a derecha que de derecha a izquierda, y <code>false</code> en caso contrario. Compara los caracteres exactamente: las mayúsculas y las minúsculas son distintas, y los espacios cuentan como cualquier otro carácter. La cadena vacía es un palíndromo.</p><p><code>s</code> tiene como máximo 1000 caracteres. Las pruebas imprimen el resultado con <code>%d</code> (1 o 0).</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>c_function</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[bool is_palindrome(const char s[]) {
    int i = 0;
    int j = (int) strlen(s) - 1;
    while (i < j) {
        if (s[i] != s[j]) {
            return false;
        }
        i++;
        j--;
    }
    return true;
}
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d\n", is_palindrome("radar"))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d\n", is_palindrome("abca"))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d\n", is_palindrome("abba"))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d %d\n", is_palindrome(""), is_palindrome("x"))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1 1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d\n", is_palindrome("Ana"))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[printf("%d %d\n", is_palindrome("12 21"), is_palindrome("12 1"))]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1 0]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>c</text></tag>
      <tag><text>strings</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Cifrado César]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escribe una función <code>void caesar(char s[], int k)</code> que cifre la cadena <code>s</code>, en el mismo arreglo, con el cifrado César: cada letra avanza <code>k</code> posiciones en el alfabeto, y al pasar de la <code>z</code> vuelve a empezar en la <code>a</code>. Las mayúsculas siguen siendo mayúsculas y las minúsculas siguen siendo minúsculas; cualquier otro carácter (dígitos, espacios, signos de puntuación) queda igual. Con <code>k</code> = 3, <code>abc XYZ</code> se convierte en <code>def ABC</code>.</p><p>0 &le; <code>k</code> &le; 1000, y <code>s</code> contiene solo caracteres ASCII.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>c_function</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[void caesar(char s[], int k) {
    k %= 26;
    for (int i = 0; s[i] != '\0'; i++) {
        if (s[i] >= 'a' && s[i] <= 'z') {
            s[i] = (char) ('a' + (s[i] - 'a' + k) % 26);
        } else if (s[i] >= 'A' && s[i] <= 'Z') {
            s[i] = (char) ('A' + (s[i] - 'A' + k) % 26);
        }
    }
}
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[char s[] = "abc XYZ";
caesar(s, 3);
printf("%s\n", s);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[def ABC]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[char s[] = "Roma";
caesar(s, 1);
printf("%s\n", s);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[Spnb]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[char s[] = "Zz-Aa 09!";
caesar(s, 2);
printf("%s\n", s);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[Bb-Cc 09!]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[char s[] = "Abc";
caesar(s, 26);
printf("%s\n", s);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[Abc]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[char s[] = "xyz";
caesar(s, 29);
printf("%s\n", s);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[abc]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[char s[] = "aZ";
caesar(s, 1000);
printf("%s\n", s);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[mL]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>c</text></tag>
      <tag><text>strings</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Mínimo y máximo]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Una función devuelve un solo valor, pero puede entregar otros resultados mediante punteros. Escribe una función <code>void min_max(const int a[], int n, int *min, int *max)</code> que guarde el menor elemento de <code>a</code> en <code>*min</code> y el mayor en <code>*max</code>.</p><p>1 &le; <code>n</code> &le; 1000, y los elementos pueden ser negativos. <code>min</code> y <code>max</code> apuntan a variables de quien llama a la función; la función no devuelve nada.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>c_function</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[void min_max(const int a[], int n, int *min, int *max) {
    *min = a[0];
    *max = a[0];
    for (int i = 1; i < n; i++) {
        if (a[i] < *min) {
            *min = a[i];
        }
        if (a[i] > *max) {
            *max = a[i];
        }
    }
}
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[int a[] = {4, 9, 1, 7};
int lo, hi;
min_max(a, 4, &lo, &hi);
printf("%d %d\n", lo, hi);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1 9]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[int a[] = {5};
int lo, hi;
min_max(a, 1, &lo, &hi);
printf("%d %d\n", lo, hi);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[5 5]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[int a[] = {-3, -8, -1};
int lo, hi;
min_max(a, 3, &lo, &hi);
printf("%d %d\n", lo, hi);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[-8 -1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[int a[] = {10, 3, 8};
int lo, hi;
min_max(a, 3, &lo, &hi);
printf("%d %d\n", lo, hi);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[3 10]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[int a[] = {2, 2, 2, 2};
int lo, hi;
min_max(a, 4, &lo, &hi);
printf("%d %d\n", lo, hi);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[2 2]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[int a[] = {1, 2, 3, 100};
int lo, hi;
min_max(a, 3, &lo, &hi);
printf("%d %d\n", lo, hi);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1 3]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>c</text></tag>
      <tag><text>pointers</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Repetir una cadena]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Escribe una función <code>char *repeat(const char *s, int k)</code> que devuelva una cadena nueva formada por <code>k</code> copias de <code>s</code>, una tras otra. Por ejemplo, <code>repeat("ab", 3)</code> devuelve <code>"ababab"</code>.</p><p>Reserva la cadena nueva con <code>malloc</code>, dejando espacio para el <code>'\0'</code> final. Quien llama a la función es dueño del resultado y lo libera con <code>free</code>. No modifiques <code>s</code>. Si <code>k</code> es 0 o <code>s</code> está vacía, devuelve una cadena nueva vacía, no <code>NULL</code>. 0 &le; <code>k</code> &le; 100, y <code>s</code> tiene como máximo 100 caracteres.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>c_function</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>15</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[char *repeat(const char *s, int k) {
    size_t len = strlen(s);
    char *result = malloc(len * k + 1);
    if (result == NULL) {
        return NULL;
    }
    for (int i = 0; i < k; i++) {
        memcpy(result + i * len, s, len);
    }
    result[len * k] = '\0';
    return result;
}
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[char *r = repeat("ab", 3);
printf("[%s]\n", r);
free(r);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[[ababab]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[char *r = repeat("xyz", 1);
printf("[%s]\n", r);
free(r);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[[xyz]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[char *r = repeat("ab", 0);
printf("[%s]\n", r);
free(r);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[[]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[char s[] = "na";
char *r = repeat(s, 2);
printf("%s %s\n", s, r);
free(r);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[na nana]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[char *r = repeat("", 5);
printf("[%s]\n", r);
free(r);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[[]]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[char *a = repeat("-", 4);
char *b = repeat("=", 2);
printf("%s %s\n", a, b);
free(a);
free(b);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[---- ==]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>c</text></tag>
      <tag><text>pointers</text></tag>
    </tags>
  </question>
  <question type="coderunner">
    <name>
      <text><![CDATA[Suma de fracciones]]></text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Una fracción se guarda en esta estructura, donde <code>num</code> es el numerador y <code>den</code> el denominador. Ya está en el cuadro de respuesta; mantenla en tu respuesta.</p><pre>struct Fraction {
    int num;
    int den;
};</pre><p>Escribe una función <code>struct Fraction add_fractions(struct Fraction a, struct Fraction b)</code> que devuelva la suma <i>a</i> + <i>b</i> como fracción irreducible, con denominador positivo. Si la suma es cero, devuelve 0/1. Por ejemplo, 1/6 + 1/3 = 3/6, que como fracción irreducible es 1/2.</p><p>En los argumentos, &minus;1000 &le; <code>num</code> &le; 1000 y 1 &le; <code>den</code> &le; 1000. Pista: divide el numerador y el denominador entre su máximo común divisor, con cuidado con los numeradores negativos.</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>1.0000000</defaultgrade>
    <penalty>0.0000000</penalty>
    <hidden>0</hidden>
    <idnumber></idnumber>
    <coderunnertype>c_function</coderunnertype>
    <prototypetype>0</prototypetype>
    <allornothing>1</allornothing>
    <penaltyregime>10, 20, ...</penaltyregime>
    <precheck>0</precheck>
    <hidecheck>0</hidecheck>
    <showsource>0</showsource>
    <answerboxlines>25</answerboxlines>
    <answerboxcolumns>100</answerboxcolumns>
    <answerpreload><![CDATA[struct Fraction {
    int num;
    int den;
};

]]></answerpreload>
    <globalextra></globalextra>
    <useace></useace>
    <resultcolumns></resultcolumns>
    <template></template>
    <iscombinatortemplate></iscombinatortemplate>
    <allowmultiplestdins></allowmultiplestdins>
    <answer><![CDATA[struct Fraction {
    int num;
    int den;
};

int gcd(int a, int b) {
    a = abs(a);
    while (b != 0) {
        int r = a % b;
        a = b;
        b = r;
    }
    return a;
}

struct Fraction add_fractions(struct Fraction a, struct Fraction b) {
    struct Fraction sum;
    sum.num = a.num * b.den + b.num * a.den;
    sum.den = a.den * b.den;
    int g = gcd(sum.num, sum.den);
    sum.num /= g;
    sum.den /= g;
    return sum;
}
]]></answer>
    <validateonsave>1</validateonsave>
    <testsplitterre></testsplitterre>
    <language></language>
    <acelang></acelang>
    <sandbox></sandbox>
    <grader></grader>
    <cputimelimitsecs></cputimelimitsecs>
    <memlimitmb></memlimitmb>
    <sandboxparams></sandboxparams>
    <templateparams></templateparams>
    <uiplugin></uiplugin>
    <attachments>0</attachments>
    <testcases>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[struct Fraction a = {1, 2}, b = {1, 3};
struct Fraction r = add_fractions(a, b);
printf("%d/%d\n", r.num, r.den);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[5/6]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="1" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[struct Fraction a = {1, 4}, b = {1, 4};
struct Fraction r = add_fractions(a, b);
printf("%d/%d\n", r.num, r.den);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[1/2]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[struct Fraction a = {3, 4}, b = {5, 4};
struct Fraction r = add_fractions(a, b);
printf("%d/%d\n", r.num, r.den);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[2/1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[struct Fraction a = {1, 2}, b = {-1, 2};
struct Fraction r = add_fractions(a, b);
printf("%d/%d\n", r.num, r.den);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[0/1]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[SHOW]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[struct Fraction a = {-1, 3}, b = {1, 6};
struct Fraction r = add_fractions(a, b);
printf("%d/%d\n", r.num, r.den);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[-1/6]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
      <testcase testtype="0" useasexample="0" hiderestiffail="0" mark="1.0000000">
        <testcode>
          <text><![CDATA[struct Fraction a = {999, 1000}, b = {1, 999};
struct Fraction r = add_fractions(a, b);
printf("%d/%d\n", r.num, r.den);]]></text>
        </testcode>
        <stdin>
          <text></text>
        </stdin>
        <expected>
          <text><![CDATA[999001/999000]]></text>
        </expected>
        <extra>
          <text></text>
        </extra>
        <display>
          <text><![CDATA[HIDE]]></text>
        </display>
      </testcase>
    </testcases>
    <tags>
      <tag><text>onlinecompiler.io</text></tag>
      <tag><text>c</text></tag>
      <tag><text>structs</text></tag>
    </tags>
  </question>
</quiz>
