• <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8" />
    <title>Is Prime Number?</title>
    </head>
    <body>
    <script type="text/javascript">
    var xNumber = +prompt("请输入一个大于1的数字:");
    var isPrimeNumber = true; if(xNumber>1 && xNumber != NaN)
    {
    for(i=2; i<xNumber; i++)
    {
    if(xNumber%i==0)
    {
    isPrimeNumber = false;
    }
    }
    }
    if(isPrimeNumber)
    {
    document.write(xNumber+" is a Prime Number.");
    }
    else
    {
    document.write(xNumber+" is NOT a Prime Number.");
    }
    </script>
    </body>
    </html>

10_ for 练习 _ is Prime Number ?的更多相关文章

  1. [Swift]LeetCode762. 二进制表示中质数个计算置位 | Prime Number of Set Bits in Binary Representation

    Given two integers L and R, find the count of numbers in the range [L, R] (inclusive) having a prime ...

  2. FZU 1649 Prime number or not米勒拉宾大素数判定方法。

    C - Prime number or not Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%I64d & % ...

  3. 每日一九度之 题目1040:Prime Number

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6732 解决:2738 题目描述: Output the k-th prime number. 输入: k≤10000 输出: The k- ...

  4. LintCode-Kth Prime Number.

    Design an algorithm to find the kth number such that the only prime factors are 3, 5, and 7. The eli ...

  5. 10 001st prime number

    这真是一个耗CPU的运算,怪不得现在因式分解和素数查找现在都用于加密运算. By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13 ...

  6. [LeetCode] Prime Number of Set Bits in Binary Representation 二进制表示中的非零位个数为质数

    Given two integers L and R, find the count of numbers in the range [L, R] (inclusive) having a prime ...

  7. C#_02.10_基础一_.NET框架

    C#_02.10_基础一_.NET框架 一.概念: .NET框架是一个多语言组件开发和执行环境,它提供了一个跨语言的统一编程环境. 解读: 1..net框架是一个编程环境, 2.可以进行多语言的开发和 ...

  8. 762. Prime Number of Set Bits in Binary Representation二进制中有质数个1的数量

    [抄题]: Given two integers L and R, find the count of numbers in the range [L, R] (inclusive) having a ...

  9. LeetCode 762 Prime Number of Set Bits in Binary Representation 解题报告

    题目要求 Given two integers L and R, find the count of numbers in the range [L, R] (inclusive) having a ...

随机推荐

  1. C++回顾day03---<异常>

    一:传统错误处理机制(C中通过函数返回来处理) int CalcRes(int n, int m, char ch, int& res) { ; switch (ch) { case '+': ...

  2. pymysql常见问题

    1.Python中pymysql出现乱码的解决方法 一般来说,在使用mysql最麻烦的问题在于乱码. 查看mysql的编码: show variables like 'character_set_%' ...

  3. Beamer中左边画图, 右边文字解释

    \begin{columns} \column{.4\textwidth} \begin{figure} \centering % Requires \usepackage{graphicx} \in ...

  4. end to end testing

    概念 https://www.softwaretestinghelp.com/what-is-end-to-end-testing/ What is “End to End Testing”? Ter ...

  5. Codeforces 1060E(dfs计数)

    题目链接 题意 给一棵树,对于一个节点,与它相邻的结点可以连一条边,求所有点对间距离之和 思路 任意两点间的距离被优化为$\left \lceil \frac{s}{2} \right \rceil$ ...

  6. 消除导入MNIST数据集发出的警告信息

    原本导入数据集你仅需这样: # Import MNIST data from tensorflow.examples.tutorials.mnist import input_data mnist = ...

  7. 基于89C51/52单片机的红外线遥控驱动

    目录 说明 IR.h IR.c 说明 编码格式:NEC IR.h /************************************************************ * @Pr ...

  8. 【JS】长轮询

    循环请求服务器数据 function send () { xhr.open('GET', '/clock', true); xhr.onreadystatechange = function () { ...

  9. 【转载】Jenkins安装以及邮件配置

    转载:http://www.nnzhp.cn/archives/590 Jenkins介绍 Jenkins是一个java开发的.开源的.非常好用持续集成的工具,它能帮我们实现自动化部署环境.测试.打包 ...

  10. tcp协议的简单理解

    tpc协议属于传输层协议,本篇主要介绍下几个概念,以及握手和挥手的过程. 1.tcp的几个概念 位码:即tcp标志位,有6种提示 SYN:synchronus,表示建立联机. ACK:acknowle ...