public class bansal{
public static void main(String [] args){
String kal1="STMIK BANISALEH";
String kal2="PEMPROGRAMAN";
int i,j;
for(i=1;i<=3;i++){
System.out.println(" ");
System.out.println(kal1);
for(j=1;j<=3;j++){
System.out.println(kal2);
}
}
}
}
Selasa, 07 Juni 2011
PERTAMBAHAN
public class tambah{
public static void main (String[] args){
int [] data1={0,1,2,3,4,5};
int [] data2={0,1,2,3,4,5};
int jum,i,j;
System.out.println("+ 0 1 2 3 4 5");
System.out.println("--------------");
for(i=0;i<=5;i++){
System.out.print(i);
for(j=0;j<=5;j++){
jum=data1[i]+data2[j];
System.out.print(" "+jum);
}
System.out.println(" ");
}
}
}
public static void main (String[] args){
int [] data1={0,1,2,3,4,5};
int [] data2={0,1,2,3,4,5};
int jum,i,j;
System.out.println("+ 0 1 2 3 4 5");
System.out.println("--------------");
for(i=0;i<=5;i++){
System.out.print(i);
for(j=0;j<=5;j++){
jum=data1[i]+data2[j];
System.out.print(" "+jum);
}
System.out.println(" ");
}
}
}
QUIZZZZZ
import java.util.Scanner;
public class dhiyay {
public static void main(String[] args){
Scanner input=new Scanner(System.in);
garis();
System.out.println(" MENU PILIHAN ");
garis();
System.out.println("1. Menhitung Nilai Mahasiswa");
System.out.println("");
System.out.println("2. Exit");
garis();
System.out.println("");
System.out.print("Anda pilih no :");
int pilih=input.nextInt();
switch(pilih){
case 1:{
int[] npm=new int[20];
String[] nama=new String[20];
String[] jur=new String[20];
String[] mk=new String[20];
int[] n_tgas=new int[20];
int[] n_uts=new int[20];
int[] n_uas=new int[20];
garis();
System.out.println(" MENGHITUNG NILAI MAHASISWA");
garis();
System.out.println("");
System.out.print("Masukan jumlah data ="); int n=input.nextInt();
for(int i=1;i<=n;i++){
System.out.println("Data ke"+i +":");
System.out.print("NPM :"); npm[i]=input.nextInt();
System.out.print("Nama :"); nama[i]=input.next();
System.out.print("Jurusan :"); jur[i]=input.next();
System.out.print("Mata Kuliah :"); mk[i]=input.next();
System.out.print("Nilai tugas :"); n_tgas[i]=input.nextInt();
System.out.print("Nilai UTS :"); n_uts[i]=input.nextInt();
System.out.print("Nilai UAS :"); n_uas[i]=input.nextInt();
double rata=(n_tgas[i]+n_uts[i]+n_uas[i])/3;
System.out.println("Nilai rata-rata ="+rata);
}
break;
}
default:System.exit(0);
}
}
static void garis(){
System.out.println("==========================================");
}
}
public class dhiyay {
public static void main(String[] args){
Scanner input=new Scanner(System.in);
garis();
System.out.println(" MENU PILIHAN ");
garis();
System.out.println("1. Menhitung Nilai Mahasiswa");
System.out.println("");
System.out.println("2. Exit");
garis();
System.out.println("");
System.out.print("Anda pilih no :");
int pilih=input.nextInt();
switch(pilih){
case 1:{
int[] npm=new int[20];
String[] nama=new String[20];
String[] jur=new String[20];
String[] mk=new String[20];
int[] n_tgas=new int[20];
int[] n_uts=new int[20];
int[] n_uas=new int[20];
garis();
System.out.println(" MENGHITUNG NILAI MAHASISWA");
garis();
System.out.println("");
System.out.print("Masukan jumlah data ="); int n=input.nextInt();
for(int i=1;i<=n;i++){
System.out.println("Data ke"+i +":");
System.out.print("NPM :"); npm[i]=input.nextInt();
System.out.print("Nama :"); nama[i]=input.next();
System.out.print("Jurusan :"); jur[i]=input.next();
System.out.print("Mata Kuliah :"); mk[i]=input.next();
System.out.print("Nilai tugas :"); n_tgas[i]=input.nextInt();
System.out.print("Nilai UTS :"); n_uts[i]=input.nextInt();
System.out.print("Nilai UAS :"); n_uas[i]=input.nextInt();
double rata=(n_tgas[i]+n_uts[i]+n_uas[i])/3;
System.out.println("Nilai rata-rata ="+rata);
}
break;
}
default:System.exit(0);
}
}
static void garis(){
System.out.println("==========================================");
}
}
AKAR DAN KUADRAT
import java.io.*;
class akar_dan_kuadrat
{
public static void main(String[] args) throws Exception
{
String angka;
int a,b,c;
double akar,kuadrat;
DataInputStream dis = new DataInputStream (System.in);
System.out.println("Masukan Angka :");
angka=dis.readLine();
a=Integer.parseInt(angka);
kuadrat=Math.pow(a,2);
akar=Math.sqrt(a);
System.out.println("Kuadrat :"+kuadrat);
System.out.println("Akar : " +akar);
}
}
class akar_dan_kuadrat
{
public static void main(String[] args) throws Exception
{
String angka;
int a,b,c;
double akar,kuadrat;
DataInputStream dis = new DataInputStream (System.in);
System.out.println("Masukan Angka :");
angka=dis.readLine();
a=Integer.parseInt(angka);
kuadrat=Math.pow(a,2);
akar=Math.sqrt(a);
System.out.println("Kuadrat :"+kuadrat);
System.out.println("Akar : " +akar);
}
}
MENCARI KUADRAT
import java.util.Scanner;
public class kuadrat{
public static void main (String [] args){
Scanner input= new Scanner(System.in);
garis();
System.out.println(" MENU PILIHAN ");
garis();
System.out.println("1. MENGHITUNG KUADRAT");
System.out.println("");
System.out.println("2. EXIT");
garis();
System.out.println("Anda pilih nomor :");
int pil=input.nextInt();
switch (pil){
case 1:{
System.out.println(" Menghitung mahasiswa");
System.out.println("Masukan datanya :");
int n=input.nextInt();
int[]data=new int[10];
for(int i=1;i<=n;i++){
System.out.println("Data ke"+i+"=");
System.out.println("angka :"); int angka=input.nextInt();
int kuadrat = angka*angka;
System.out.println("hasil kuadrat :" +kuadrat);
System.out.println(" ");
}
break;
}
default:System.exit(0);
}}
static void garis(){
System.out.println("--------------------------");
}
}
public class kuadrat{
public static void main (String [] args){
Scanner input= new Scanner(System.in);
garis();
System.out.println(" MENU PILIHAN ");
garis();
System.out.println("1. MENGHITUNG KUADRAT");
System.out.println("");
System.out.println("2. EXIT");
garis();
System.out.println("Anda pilih nomor :");
int pil=input.nextInt();
switch (pil){
case 1:{
System.out.println(" Menghitung mahasiswa");
System.out.println("Masukan datanya :");
int n=input.nextInt();
int[]data=new int[10];
for(int i=1;i<=n;i++){
System.out.println("Data ke"+i+"=");
System.out.println("angka :"); int angka=input.nextInt();
int kuadrat = angka*angka;
System.out.println("hasil kuadrat :" +kuadrat);
System.out.println(" ");
}
break;
}
default:System.exit(0);
}}
static void garis(){
System.out.println("--------------------------");
}
}