我正在使用划痕。我从用户那里获得了两个值,并且必须找到可被2&分割的数字。 3在这些值之间。如何在不使用数组的情况下计算这些数字(仅使用基本操作)?
答案 0 :(得分:2)
如果您只需要计算这些数字,则不需要数组。只需遍历范围并计算:
答案 1 :(得分:0)
这是您可以做的(请注意,我不擅长创建问题和变量)...
yy.mm
那么,为什么需要一个const text =
'By clicking on the registration button, you declare that you are of legal age and accept the <a href="#" target="_blank">Legal Conditions</a>.';
const LegalConditions = ({ text }) => {
const [messageText, linkText, endText] = text.split(/<[a][^>]*>(.+?)<\/[a]>/)
return <p>{messageText}<a href="#/" onClick={console.log}>{linkText}</a>{endText}</p>;
};
变量?这是因为某些数字可以同时被2和3整除,这意味着如果更改了代码,该数字将被记录两次。但是,如果您希望这种情况发生,那么这将是适合您的代码:
when flag clicked
ask (starting number is?) and wait
set (startrange) to (answer)
ask (ending number is?) and wait
set (endrange) to (answer)
set (counter) to (startrange)
set (divisibleby2) to (0)
set (divisibleby3) to (0)
set (divisibleby6) to (0)
repeat until counter = endrange
if (counter) mod 6 = 0
change (divisibleby6) by (1)
else
if (counter) mod 3 = 0
change (divisibleby3) by (1)
else
if (counter) mod 2 = 0
change (divisibleby2) by (1)
say (join (The number of numbers from the two inputs that are divisible by 2, 3 is) ((divisibleby2) + ((divisibleby3) + (divisibleby6)))