close
output:
5 7 9 11 ///////////////
10 8 6 4 ***********

以下為程式碼
loop2_01.java
class loop2_01
{
    public static void main(String[] args)
    {
        int i=3;
        int j=12;
       
        if(i>2)
        {
       
        while(i<11)
        {
            i+=2;
            System.out.print(i+" ");
        }
        System.out.println("///////////////");
        }
       
        if(j>11)
        {
        while(j>4)
        {
            j-=2;
            System.out.print(j+" ");
        }
        System.out.println("***********");
    }

    }
}
arrow
arrow
    全站熱搜

    gtea0609 發表在 痞客邦 留言(0) 人氣()