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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><style type="text/css"&g
/** *把1到100之间的数的偶数相加 */ class Demo{ public static void main(String[] args){ int i =1; int sum = 0; do{ if(i % 2 != 0){ sum += i; } //累加器需要在if语句外面 i++; }while(i <= 100); System.out.println(sum); } }
#-*- coding:UTF-8 -*- #环境:python3 print("Enter the numbers between 1 and 100:") enterList=[] #记录输入的元素 while 1: a = int(input(">>>")) #将输入转换为int型 if a == 0: print ("Your input:",enterList) break #结束输入 if a<1 or a&g