Program Java For
Program Pembagian
import java.util.Scanner ;
public class bagi5i {
public static void main(String[] args) {
Scanner input = new Scanner(System.in) ;
System.out.println("======BELAJAR PEMBAGIAN======") ;
System.out.println("==Masukkan Bilangan Yang Akan Dibagi==") ;
int a = input.nextInt() ;
System.out.println("==Masukkan Bilangan Pembagi==") ;
int b = input.nextInt() ;
int ab = 0 ;
for( a = a; a >= b; a /= b ) {
ab += a ;
double pecahan = (double) a / b ;
System.out.println(" Hasil " +a+ " Dibagi " +b+ " = "+pecahan) ;
}
}
}
public class bagi5i {
public static void main(String[] args) {
Scanner input = new Scanner(System.in) ;
System.out.println("======BELAJAR PEMBAGIAN======") ;
System.out.println("==Masukkan Bilangan Yang Akan Dibagi==") ;
int a = input.nextInt() ;
System.out.println("==Masukkan Bilangan Pembagi==") ;
int b = input.nextInt() ;
int ab = 0 ;
for( a = a; a >= b; a /= b ) {
ab += a ;
double pecahan = (double) a / b ;
System.out.println(" Hasil " +a+ " Dibagi " +b+ " = "+pecahan) ;
}
}
}
Output
Comments
Post a Comment