Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package algoritma;
- /**
- *
- * @author aldi
- */
- import java.util.Scanner;
- public class faktorial {
- public static void main(String [] args) {
- Scanner input = new Scanner(System.in);
- System.out.println ("masukan angka faktorial");
- int angka;
- angka = input.nextInt();
- int hasil = 1 ;
- int jumlah = 1;
- while (jumlah<=angka) {
- hasil=hasil*angka;
- angka = angka - 1;
- System.out.print(""+angka+" x ");
- }
- System.out.println(" faktorial"+angka*angka);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement