-3
A
回答
1
所以答案是:
int b = 60;
for (int i=0; i < 30 ; i++)
{
System.out.println(b-2*i);
}
+4
我不能接受別人的答案,至少請接受你的答案! – 2014-09-06 09:56:41
1
這可能是有益的
Scanner in = new Scanner(System.in);
System.out.println("Enter the upper limit");
List<Integer> list = new ArrayList<Integer>();
int n = in.nextInt();
if(n%2==0) {
for (int i=n;i>0;i-=2){
list.add(i);
}
}
else{
for (int i=n-1;i>0;i-=2){
list.add(i);
}
}
for(Integer i :list){
System.out.print(i+" ");
}
首先,你可以要求用戶輸入的限制,從要顯示偶數系列那麼如果限制檢查即使它只是執行奇數的邏輯,然後顯示來自下一個較低的系列甚至是極限
相關問題
- 1. 使用for循環顯示內容
- 2. 使用for循環顯示數組
- 3. 顯示PHP數組值外「for循環」
- 4. WHILE循環顯示出比FOR循環
- 5. 要顯示在for循環
- 6. 使用數組for循環for循環
- 7. 顯示矢量的內容與for循環一個值顯示
- 8. for循環使用for循環中聲明的變量值?
- 9. 使用xml值循環顯示數組
- 10. 使用嵌套循環在while循環中顯示特定值?
- 11. 使用「for循環」
- 12. 使用for循環
- 13. 使用for循環
- 14. 使用for循環
- 15. 使用for循環
- 16. 使用For循環
- 17. 使用for循環
- 18. 使用「for」循環
- 19. 用for循環求和值
- 20. For循環和值用awk
- 21. For循環只顯示從火力
- 22. For循環與gnuplot一次顯示鍵
- 23. C#for循環顯示所有記錄
- 24. 在for循環中顯示錶格
- 25. 在for循環中顯示MBProgressHUD
- 26. For循環代碼不顯示
- 27. C++ for循環顯示模式
- 28. For循環陣列顯示器
- 29. javascript - for循環appendChild實時顯示
- 30. jquery for循環顯示隱藏元素
對於n = 0到n = 30的'60 - 2n':v – 2014-09-06 09:40:08
您能夠認識到這些數字之間有什麼關係? – 2014-09-06 09:40:15
來吧夥計停止標記是一個壞問題,並幫助我。對於這個領域的新人來說這不公平。 – Trojan 2014-09-06 09:40:52