0% found this document useful (0 votes)
14 views3 pages

Lab Exercises 3.0

latihan java

Uploaded by

muhdshixo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

Lab Exercises 3.0

latihan java

Uploaded by

muhdshixo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Ipan zambri

LAB EXERCISES

LABEX 7

public class labex11 {


public static void main(String args[])
{
int i, j, k;
int n = 5;

for(i = 1; i <= 5; i++){

for(j = 1; j <= n; j++)


System.out.print(" ");

for(k = 1; k <= i; k++)


System.out.print(k + " ");
n--;

System.out.println();
}
}
}

LABEX 8

import java.io.*;
public class labex12 {
public static void main(String
args[])throws IOException
{
BufferedReader in = new
BufferedReader(new
InputStreamReader(System.in));

System.out.print("Masukkan
nombor sifir yang anda inginkan:
");
int num =
Integer.parseInt(in.readLine());

int i, mul;

for(i = 1; i <= 10; i ++){


mul = i * num;
System.out.println(i + " * "
+ num + " = " + mul);
}
Ipan zambri

}
}

LABEX 9

public class labex13 {


public static void main(String args[])
{
System.out.println("Series 1");

int i, k;

for(i = 1; i <= 4; i++){


for(k = 1; k <= i; k++){
System.out.print(k + " ");
}
System.out.println();
}
System.out.println("\nSeries 2");

for(i = 1; i <= 7; i +=2){


System.out.print(i + ", ");
}
System.out.print("...n");
System.out.println("\n\nSeries
3");

for(i = 1; i < 10; i++){


System.out.print(i);

if(i % 3 == 0){
System.out.println();
}
}
}
}

LABEX 10

public class labex14 {


public static void main(String args[])
{
int i = 0, j = 1, k;
int l = 2;

System.out.print(i + ", " + j);


Ipan zambri

while(l < 7){


k = i + j;
System.out.print(", " + k);

i = j;
j = k;

l++;
}
}
}

You might also like