package printDaffodilNumber; /* * 题目:打印出所有的"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该数本身.(100~1000) * 比如:153是一个"水仙花数",因为153=1的三次方+5的三次方+3的三次方. */ public class printNumber { static int number1; static int number2; static int number3;
using System;namespace Loops{ class Program { static void Main(string[] args) { /*局部变量定义*/ int i, j; for (i = 2; i < 100; i++) { for (j = 2; j <= i / j; j++) if ((i % j) == 0) break;//如果找到,则不是质数 if (j > (i / j)) Console.WriteLine("{0} 是质数 /n
素数指在一个大于1的自然数中,除了1和此整数自身外,没法被其他自然数整除的数.换句话说,只有两个正因数(1和自己)的自然数即为素数(也叫质数).比1大但不是素数的数称为合数.1和0既非素数也非合数. package main import ( "fmt" ) func main() { fmt.Println("1-100之间的质数为:") // i应直接从2开始 for i := 2; i <= 100; i++ { for n := 2; n <=
/** * 使用BlockingQueue实现主子线程互相打印 * @author duwenlei * */ public class BlockingQueueTest { public static void main(String[] args) { final Business business = new Business(); new Thread(new Runnable() { @Override public void run() { while(true){ busines
class Program { public static List<int> list; static void Main(string[] args) { Console.WriteLine("请输入下限:"); int min = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("请输入上限:"); int max = Convert.ToInt32(Console.ReadLine()
declare i number:=1; j number:=0; sum1 number:=0;begin while(i<100) loop i:=i+1; j:=2; while(mod(i,j)!=0) loop j:=j+1; if(i=j) then exit; end if; end loop; if(i=j) then sum1:=sum1+i; DBMS_OUTPUT.PUT_LINE(i); end if; end loop; DBMS_OUTPUT.PUT_LINE(SUM