• <!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. GO 基础

    基本语法练习 打印 乘法表 package main import ("fmt") func main(){ for n:=1;n<=9;n++{ for m:=1;m< ...

  2. APPLE-SA-2019-3-25-1 iOS 12.2

    APPLE-SA-2019-3-25-1 iOS 12.2 iOS 12.2 is now available and addresses the following: CFStringAvailab ...

  3. Python3:OOP Demo

    方便快速回顾Python的OOP语法 ###################### # 类的私有专有方法 # ###################### # __init__ : 构造函数,在生成对 ...

  4. 你对安卓触控一体机了解多少?视野还停留在windows一体机上?

    android一体机可以根据用户的不同需求拓展各种不同的硬件外接设备和各种应用软件,环境适应能力又强,所以在诸多领域的应用都非常受欢迎,并且还在不断地开拓新市场.安卓系统触摸一体机占据绝对性优势. 1 ...

  5. Notepad++崩溃后文件内容找不到问题

    也许是因为Ctrl + s 摁太多太频繁,一不小心Notepad++崩溃了 重启后发现原来的文件还在,但是文件内容全部都被清空了 我没有手动备份这个文件, 如何找回??? 点击设置,首选项,里面有个备 ...

  6. android dialog设置全屏半透明背景色

    style代码如下: <style name="theme_dialog" parent="@android:style/Theme.Dialog"> ...

  7. (原创)cocos lua 热更新从零开始(一)最简单demo

    开发环境:WIN7 + cocos2dx 3.10 lua版本 0.学习这篇内容的基础是你要会创建并运行一个cocos lua项目 1.热更新的思想所谓的热更新,就是在线更新代码和资源.热更新的过程首 ...

  8. POJ1321 棋盘问题(简单搜索)

    题意: 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别.要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放 ...

  9. noj算法 迷宫问题 回溯法

    描述: 给一个20×20的迷宫.起点坐标和终点坐标,问从起点是否能到达终点. 输入: 多个测例.输入的第一行是一个整数n,表示测例的个数.接下来是n个测例,每个测例占21行,第一行四个整数x1,y1, ...

  10. NOIP2016换教室

    题目 一道毒瘤概率期望DP.点这里 首先 对于每个时间段(就是每节课),我们有申请和不申请两种情况.如果不申请的话,一定在$ c[ i ] \(,否则,可能在\)c[ i ]\(,也可能在\)d[ i ...