小编eth*_*nzh的帖子

我的"最低常见倍数"程序挂起,并没有输出答案

我一直在努力学习编程,所以我一直在努力创建一个简单的程序,它将两个数字作为输入,并计算最低的公共倍数.我在Python中这样做是因为我不知道如何在Java中输入.现在发生的事情是,在我输入数字后程序就会挂起,没有任何反应.这里的任何指针将不胜感激.谢谢.

#LCM Calculator
#Author: Ethan Houston
#Language: Python
#Date: 2013-12-27
#Function: Program takes 2 numbers as input, and finds the lowest number
# that goes into each of them

def lcmCalculator(one, two):
    """ takes two numbers as input, computes a number that evenly 
        divides both numbers """
    counter = 2 #this is the number that the program tried to divide each number by.
                #it increases by 1 if it doesn't divide evenly with both numbers.
    while True:
        if one % …
Run Code Online (Sandbox Code Playgroud)

python if-statement function lcm while-loop

2
推荐指数
1
解决办法
230
查看次数

如何将 CSS 应用于 document.write()?

我有一个程序将使用 Javascript 使用“document.write()”将值“打印”到屏幕上。打印的值是一个整数。我希望能够使用 CSS 将样式应用于正在打印的这个整数。下面是我尝试做的一些截断的示例代码,但它不起作用(程序只是退出:

var number = 5 //just for an example
document.write('<p id="jstext"' + number + '</p>')
Run Code Online (Sandbox Code Playgroud)

这是我正在使用的 CSS 代码:

#jstext {
    text-align: center;
    font-size: 90px;
}
Run Code Online (Sandbox Code Playgroud)

谢谢

html javascript css printing

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

css ×1

function ×1

html ×1

if-statement ×1

javascript ×1

lcm ×1

printing ×1

python ×1

while-loop ×1