Jeliot || Big Integer

Posted by Didi Setyapramana On 7:46 AM 0 komentar

Berikut ini adalah program Big Integer versi Jeliot. Semoga bermanfaat :)

import jeliot.io.*;

public class bigInteger {
    int []A = new int [1,2,3,4,5,6,7,8,9];
    int []B = new int [1,2,3,4,5,6,7,8,9];
    int n,m;
    int []jumlah = new int [20];
    
   
      
    public void cetak_big(){
     System.out.print("masukkan jumlah bilangan = ");
     n=Input.readInt();
     System.out.print("\nbilangan 1 \n");
     for (int i=0;i<n;i++){
     System.out.print("angka ke - [ ");
     System.out.print(i+1);
     System.out.print("] = ");
     A[i]=Input.readInt();
     }
     
     System.out.print("\nbilangan 2 \n");
     for (int i=0;i<n;i++){
     System.out.print("angka ke - [ ");
     System.out.print(i+1);
     System.out.print("] = ");
     B[i]=Input.readInt();
     }
     }
     
    public void cetak_jumlahbig(){
     for(int i=n; i>=0; i--){
     jumlah[i]=A[i]+B[i];
     if(jumlah[i]>9){
     jumlah[i]=x % 10;
     jumlah[i-1]=jumlah[i-1]+1;
     System.out.print(jumlah[i]);
     }
     
     if(jumlah[i]<=9){
     System.out.print(jumlah[i]);
     }
     }
     }
    
    public static void main() {
     bigInteger x = new bigInteger();
     x.cetak_big();
     x.cetak_jumlahbig();
     
   
}
}

Categories:

0 Response for the "Jeliot || Big Integer"

Post a Comment