Advertisement
TheSTRIG

lab4a

Oct 8th, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Lab4a
  4. {
  5.     public static void main(String[] args)
  6.     {
  7.         Scanner hue = new Scanner(System.in);
  8.         System.out.print("Masukkan angka: ");
  9.         int nilai = hue.nextInt();
  10.        
  11.         System.out.print("Faktor bilangannya: ");
  12.        
  13.         int tambah = 0;
  14.         for (int i = 0; i <= nilai; i++)
  15.         {
  16.             tambah++;
  17.             if (nilai % tambah == 0)
  18.             {
  19.                 System.out.print(tambah + " ");
  20.             }
  21.         }
  22. }
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement