返回列表 發帖

for 迴圈 (二)

顯示0~100間所有偶數,直向排列。

  1. public class Ch01 {

  2.         public static void main(String[] args) {
  3.                 for(int i=0;i<=100;i+=2)               
  4.                 {
  5.                         System.out.println(i);
  6.                 }
  7.         }

  8. }
複製代碼

TOP

  1. public class Ch10 {

  2.         public static void main(String[] args) {
  3.                 for(int i=0; i<=100; i+=2)
  4.                 {
  5.                         System.out.println(i);
  6.                 }       

  7.         }

  8. }
複製代碼

TOP

  1. public class Ch01 {

  2.         public static void main(String[] args) {
  3.                
  4.                 for(int i=0; i<=100;i+=2)
  5.                
  6.                 {       
  7.                
  8.                         System.out.println(i);
  9.                
  10.             }       
  11.         }       
  12. }               
複製代碼

TOP

  1. public class Ch10 {

  2.         public static void main(String[] args) {
  3.                 for(int i=0;i<=100;i+=2){
  4.                         System.out.println(i);
  5.                 }
  6.                 }
  7.         }
  8.                
  9.                
複製代碼

TOP

  1. package fine;

  2. public class foradd {

  3.         public static void main(String[] args) {
  4.                 for(int i=1;i<=100;i++)
  5.                 {
  6.                         System.out.println(i);
  7.                 }

  8.         }

  9. }
複製代碼

TOP

  1. import java.util.Scanner;


  2. public class Ch01
  3. {
  4.    
  5.     public static void main(String[] args)
  6.     {
  7.          for(int i=0; i<=100; i=i+2 )
  8.          {
  9.                 System.out.println(i);
  10.          }
  11.         }

  12. }
複製代碼

TOP

  1. public class Ch13{
  2.         public static void main(String[] args){
  3.             
  4.             for(int i=0; i<=100; i+=2)   //i++   i=i+1   i+=1
  5.             {
  6.                 System.out.println(i);
  7.             }        
  8.         }
  9. }
複製代碼

TOP

  1. import java.util.Scanner;
  2. public class Ch03
  3. {
  4.         public static void main(String args[]){
  5.         for (int i=0; i<=100; i=i+2)
  6.         {
  7.                 System.out.println(i);
  8.         }
  9.         }
  10. }
複製代碼

TOP

  1. public class Ch01 {

  2.         public static void main(String[] args) {
  3.    
  4.                 for(int i=0 ; i<=100 ; i=i+2)
  5.                 {
  6.                         System.out.println(i);   
  7.                 }
  8.         }

  9. }
複製代碼

TOP

  1. public class Ch21 {
  2.     public static void main(String args[]){
  3.             for(int i=0; i<=100; i+=2)
  4.             {
  5.                     System.out.println(i);
  6.             }       
  7.     }
  8. }
複製代碼

TOP

  1. public class ch02 {
  2.         public static void main(String args[]){
  3.                 for(int i=0;i<=100;i+=2)
  4.                 {
  5.                         System.out.println(i);
  6.                 }       
  7.         }

  8. }
複製代碼
我好帥
我超級帥
我非常的帥
我宇宙第一帥

TOP

  1. package ch01;

  2. public class ch02
  3. {
  4.         public static void main(String[] args)
  5.         {
  6.                 for(int i=0;i<=100;i+=2)
  7.                         System.out.println(i);
  8.         }
  9.        

  10. }
複製代碼

TOP

  1. public class Ch14 {

  2.         public static void main(String[] args) {
  3.         for(int i=0; i<=100; i+=2)
  4.         {
  5.                  System.out.println(i);
  6.         }
  7.         }
  8. }
複製代碼

TOP

  1. public class Ch02 {

  2.         public static void main(String[] args) {
  3.                 // 初始值;持續的條件;變化方式
  4.                 for(int i=0; i<=100; i+=2) //i++ i=i+2 i+=2
  5.                 {
  6.                         System.out.println(i);
  7.                 }

  8.         }

  9. }
複製代碼

TOP

  1. public class CH03 {

  2.         public static void main(String[] args)
  3.         {
  4.             for(int i=0;i<=100;i+=2)
  5.             {
  6.                     System.out.println(i);
  7.             }

  8.         }

  9. }
複製代碼

TOP

  1. public class Ch115 {

  2.         public static void main(String[] args) {
  3.                 int i;
  4.                 for(i=0; i<=100; i=i+2)
  5.                 System.out.println(i);
  6.                        

  7.         }

  8. }
複製代碼

TOP

  1. public class Ch99 {
  2.         public static void main(String[] args) {
  3.                 //初始值;持續的條件;變化方式
  4.                 for(int i=0;  i<=100; i+=2)  //i++ i=i+1 i+=1
  5.                 {
  6.                         System.out.println(i);
  7.                 }       
  8.         }

  9. }
複製代碼

TOP

  1. import java.util.Scanner;
  2. public class Ch01 {
  3.     public static void main(String[]args){
  4.         for(int i=0;i<=100;i+=2){
  5.             System.out.print(i);       
  6.         }
  7.         }
  8. }
複製代碼

TOP

  1. import java.util.Scanner;
  2. public class Ch01 {

  3.         public static void main(String[] args) {
  4.                 for(int i=100; i>0; i-=2)
  5.                 {
  6.         System.out.println(i);
  7.         }

  8. }
  9. }
複製代碼

TOP

返回列表