Cruz Castillo

Generation

generate functionFri, 26 May 2023

Using for while loop, code to the serie 0, 1, 1, 2, 3, 5, 8, 13, 21, 34

public static void main(String[] args) { int a = 0; int b = 1; int c; System.out.println(a); System.out.println(b); for (int i = 0; i < 8; i++) { c = a + b; System.out.println(c); a = b; b = c; } }

Want to kickstart your project?Use the new AI Studio to create your code