Soal :
1 = 1
1 * 3 = 3
1 * 3 * 5 = 15
1 * 3 * 5 * 7 = 105
1 * 3 * 5 * 7 * 9 = 945
Coding:
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();
for (i=1;i<=min;i++)
{
if (i%2!=0){
jum=1;
for (j=1;j<=i;j++)
{
if (j != 1 && j%2!=0){
System.out.print("*");
}
if(j%2!=0){
System.out.print(j);//<<j;
jum = jum * j;
}else if (j==1){
System.out.print(j);//<<j;
jum = jum * j;
}
}
System.out.println("\t\t= "+jum);//"\t\t= "<<jum<<endl;
}
}
}
}
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();
for (i=1;i<=min;i++)
{
if (i%2!=0){
jum=1;
for (j=1;j<=i;j++)
{
if (j != 1 && j%2!=0){
System.out.print("*");
}
if(j%2!=0){
System.out.print(j);//<<j;
jum = jum * j;
}else if (j==1){
System.out.print(j);//<<j;
jum = jum * j;
}
}
System.out.println("\t\t= "+jum);//"\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 :