Your SlideShare is downloading. ×
TUGAS

                             PEMROGRAMAN KOMPUTER II
                                            looping


Nama    ...
2. class TgFor02
   {
         public static void main (String arg [])
   {
         for(int i=50;i>=40;i=i-2)
         {S...
4. class TgFor04
   {
         public static void main (String arg [])
   {
         int j=0;
         for(int i=4;i<=8;i=...
6. class TgFor06
   {
         public static void main (String arg [])
   {
         int j=9;
         for(int i=7;i>=1;i=...
8. class TgFor08
{
         public static void main (String arg [])
{
         int j=0;
         int k=13;
         int l=...
Upcoming SlideShare
Loading in...5
×

&Y tgs P kii for

551

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
551
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "&Y tgs P kii for"

  1. 1. TUGAS PEMROGRAMAN KOMPUTER II looping Nama : Oktavian Dani E Jurusan : Ti’08 A NIM : 08.11.0578 1. class TgFor01 { public static void main (String arg []) { for(int i=1;i<=10;i=i+1) {System.out.print(i+", ");} } } Output:
  2. 2. 2. class TgFor02 { public static void main (String arg []) { for(int i=50;i>=40;i=i-2) {System.out.print(i+", ");} } } Output: 3. class TgFor03 { public static void main (String arg []) { for(int i=13;i<=25;i=i+2) {System.out.print(i+", ");} } } Output:
  3. 3. 4. class TgFor04 { public static void main (String arg []) { int j=0; for(int i=4;i<=8;i=i+2) {j=j+4; System.out.println("a= "+i); System.out.println("b= "+j); } } } Output: 5. class TgFor05 { public static void main (String arg []) { int j=4; for(int i=2;i<=8;i=i+3) { System.out.println("a= "+i); System.out.println("b= "+j); } } } Output:
  4. 4. 6. class TgFor06 { public static void main (String arg []) { int j=9; for(int i=7;i>=1;i=i-4) { j=j-4; System.out.println("a= "+i); System.out.println("b= "+j); } } } Output: 7. class TgFor07 { public static void main (String arg []) { for(int i=1;i<=5;i=i+2) { System.out.println("a= "+i); } for(int j=6;j<=10;j=j+2) { System.out.println("b= "+j); } } } Output:
  5. 5. 8. class TgFor08 { public static void main (String arg []) { int j=0; int k=13; int l=-1; for(int i=3;i<7;i=i+3) { l=l+2; j=j+2; k=k-3; System.out.println("No "+l+" Data a= "+i); System.out.println("No "+j+" Data b= "+k); } } } Output:

×