Quick actions

cmd+k|ctrl+k

Navigation

Languages

While Loop

Snippet info

Language

Java

Visibility

public

Author

junitalaras18

Created

2024-11-05T13:31:37.680017Z

Updated

2024-11-05T13:33:08.270233Z

public class Main {
//Junita Laras Wati
    
    public static void main(String[] args) {
        // Menampilkan deret Fibonacci menggunakan while loop
        int a = 0, b = 1;
        System.out.println(a);
        System.out.println(b);

        while (a + b <= 100) {
            int c = a + b;
            System.out.println(c);
            a = b;
            b = c;
        }
    }
}

INFO