Responsive Banner design
Home » » [3.5 FAKTOR SUATU BILANGAN]

[3.5 FAKTOR SUATU BILANGAN]

1. RAPTOR :






2. C++ :

#include <iostream>
#include <string>

using namespace std;
int main()
{
   int i, x;

  
   cout <<"masukan angka : ";
   cin >> x;
   i =4;
   while (!(x==1))
   {
      if (x % 2==0)
      {
         x =x/2;
         cout << 2 << endl;      }
      else
      {
         if (x % 3==0)
         {
            x =x/3;
            cout << 3<<endl;       }
         
        
         i =i+1;
         if (x % i==0)
         {
            x =x/i;
            cout << i<<endl;         }
       
      }
      
   }

   return 0;
}


3. JELIOT :

import jeliot.io.*;

public class MyClass {public static void faktor (int x){
int i = 4;
       while (!(x == 1))
       {
          if (x % 2 == 0)
          {
             x = x / 2;
             System.out.print(2);
             System.out.print("\n");
          }
          else
          {
             if (x % 3 == 0)
             {
                x = x / 3;
                System.out.print(3);
                System.out.print("\n");
             }


             i = i + 1;
             if (x % i == 0)
             {
                x = x / i;
                System.out.print(i);
                System.out.print("\n");
             }

          }

       }
       }

    public static void main() {
    int z;
    System.out.print("masukan angka : ");
    z=Input.readInt();
    faktor(z);

   
        // Your algorithm goes here.

    }
}

0 komentar:

Posting Komentar

About Our Blog

Diberdayakan oleh Blogger.