Sistem Komputer 2kb01

Program Java Deret Sederhana 2kb01

Nama: Okto Prasetiyo I.
Kelas: 2Kb01
NPM: 25110268

Program java bilangan ganjil...

coding:

public class deret{
public static void main (String [] args){
for (int a=1;a<=20;a++) //nilai ganjil dari 1 -> 20
{

if (a==1) //mulai dari angka 1
{
System.out.print(a);} //hasil

else if (a%2==1){
System.out.print(", "+a);}}}} // pembatas nilai ","


Program java deret fibonaci...

coding:

public class fibonaci {
public static void main(String[]args){
int a=1,b=1;
int n = 10; // input deret fibonacci
System.out.print(a+" ");
for (int i=1;i

0 comments: