Nama : Nur Widya Susilo
NPM : 25110150
Judul Tugas : Deret Ganjil
Link Blog
//Deret Ganjil NWS
public class DeretGanjil
{
public static void main(String[] args) {
System.out.println(" ");
System.out.print("Bilangan Ganjil : "); //Mendeklarasikan bilangan ganjil
int x;
for(x=1;x<13;x+=2)
System.out.print(" "+ x);
System.out.println(" ");
}
}
Judul Tugas : Deret Fibonanci
//Fibonanci NWS
public class Fibonanci
{
public static int fibbon(int z)
{
if
(z<=0 || z<=1)
{
return z;
}
else
{
return fibbon(z-2)+fibbon(z-1);
}
}
public static void main(String[] args) {
System.out.println();
System.out.print("Deret Fibonanci : ");
int n=10;
for (int i=0;i<n;i++){
System.out.print(fibbon(i)+" ");
}
System.out.println();
}
}