Contoh perkalian deret bilangan genap :
output:
2*4*6*8*10*12=46080
Coding
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package allaboutalgoritma;
import java.util.Scanner;
/**
*
* @author dimata005
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int i, j, min, jum;
boolean prima;
Scanner input = new Scanner(System.in);
System.out.print("Masukkan nilai batas awal: ");
min = input.nextInt();
j=2;
//System.out.print(2);//<<j;
for (i=2;i<=min;i=i+2)
{
if(i==2){
System.out.print(2);//<<j;
}else{
System.out.print(" * ");
System.out.print(i);//<<j;
j = j * i;
}
}
System.out.println("\t\t= "+j);//"\t\t= "<<jum<<endl;
}
}
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package allaboutalgoritma;
import java.util.Scanner;
/**
*
* @author dimata005
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int i, j, min, jum;
boolean prima;
Scanner input = new Scanner(System.in);
System.out.print("Masukkan nilai batas awal: ");
min = input.nextInt();
j=2;
//System.out.print(2);//<<j;
for (i=2;i<=min;i=i+2)
{
if(i==2){
System.out.print(2);//<<j;
}else{
System.out.print(" * ");
System.out.print(i);//<<j;
j = j * i;
}
}
System.out.println("\t\t= "+j);//"\t\t= "<<jum<<endl;
}
}
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :