for i=1 to 100 if (i mod 3)<>0 then n=n+1 print i,end if next i print print "1-100之间共有";n;"个不能被3整除的数"end
/*** [说明]:用while和for循环输出1到100之间能被5整除的数,且每行输出3个。 *@authoraeon*/publicclassTestWhileFor {publicstaticvoidmain(String[] args) { System.out.println("###while###");inti=1;while(i<=100){if(i%5==0){ System.out.print(i+"\t"); }if(i%(3*5)==0){//这...
public class ForDemo03 { public static void main(String[] args) { //用for循环输出1-1000之间能被5整除的数,并且每行输出3个 int i; int a = 0; //每行的个数 for (i = 0; i <= 1000; i++) { if(i%5 == 0){ System.out.print(i+"\t"); a++; } if(a%3 == 0){ //输...
* [说明]:⽤while和for循环输出1到100之间能被5整除的数,且每⾏输出3个。* @author aeon */ public class TestWhileFor { public static void main(String[] args) { System.out.println("###while###");int i=1;while(i<=100){ if(i%5==0){ System.out.print(i+"\t");} if(i%(...
= 0 for num in range(5, 101, 5): print('%d ' % num, end='') i += 1 ...