Program
ke -1
import
java.util.Scanner;
public
class Modulo
{
public static void main(String args[])
{
Scanner masuk=new
Scanner(System.in);
int bil;
System.out.println(" <<Class Kelipatan>> ");
System.out.println(" =================== ");
System.out.print("Masukan
bilangan = ");
bil=masuk.nextInt();
System.out.println("");
System.out.println("Bilangan
diatas termasuk :");
System.out.println("==========================");
if(bil%3==0)
System.out.println("Bilangan
Kelipatan 3");
System.out.println(" ");
if(bil%6==0)
System.out.println("dan
Bilangan Kelipatan 6");
System.out.println(" ");
}
}
|
Hasil
:
Program
ke -2
import
java.util.Scanner;
public
class terbesarterkecil
{
public static void main(String args[])
{
Scanner masuk=new
Scanner(System.in);
int a,b,c;
System.out.print("Masukan
nilai a = ");
a=masuk.nextInt();
System.out.print("Masukan
nilai b = ");
b=masuk.nextInt();
System.out.print("Masukan
nilai c = ");
c=masuk.nextInt();
System.out.println("");
System.out.println("=====================");
if((a>b) && (a>c))
System.out.println("Bilangan
Terbesar = "+a);
if((b>a) && (b>c))
System.out.println("Bilangan
Terbesar = "+b);
if((c>a) && (c>b))
System.out.println("Bilangan
Terbesar = "+c);
if((a<b) && (a<c))
System.out.println("Bilangan
Terkecil = "+a);
if((b<a) && (b<c))
System.out.println("Bilangan
Terkecil = "+b);
else
System.out.println("Bilangan
Terkecil = "+c);
System.out.println("");
}
}
|
Hasil
: