Jump to content
×
×
  • Create New...

Lorem Ipsum is simply dummy text

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s

Test Test

Lorem Ipsum is simply dummy text

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s

Test Test

Lorem Ipsum is simply dummy text

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s

Test Test

Lorem Ipsum is simply dummy text

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s

Test Test

Lorem Ipsum is simply dummy text

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s

Test Test

  • Bu Alana Reklam Verebilirsiniz
    Bu Alana Reklam Verebilirsiniz

Onluk Sayıyı İkilik Sayıya Çeviren Program Örneği ve Kodu | Java

Rate this topic


serverIR
 Share


Recommended Posts

Onluk Sayıyı İkilik Sayıya Çeviren Program Örneği ve Kodu | Java
 Share


  • Members

Onluk sistemdeki bir sayıyı ikilik sisteme çevirmek için, onluk sistemdeki sayının bölümü 2 değerine sürekli olarak bölünmektedir. Sonra elde edilen sonuç ve kalanlar (sıfırlar dahil) sırayla eklenerek 10luk sistemdeki sayı ikilik sisteme çevrilmiş olur. Bu java örneğinde onluk sistemdeki bir sayıyı ikilik sisteme çeviren programın kodlarını yazacağız.

 

 

Java Kodu:

 

public class JavaOrnekleri {
  
   static public void binaryDonustur(int sayi){
     int binary[] = new int[40];
     int index = 0;
     while(sayi > 0){
       binary[index++] = sayi%2;
       sayi = sayi/2;
     }
     for(int i = index-1;i >= 0;i--){
       System.out.print(binary[i]);
     }
  }
 
  public static void main(String a[]){
     
     System.out.print("1234: ");
     binaryDonustur(1234);
     System.out.print("\n18: ");
     binaryDonustur(18);
System.out.print("\n");
  }
}

 

Çıktı:

decimal-to-binary-convertor-java.webp

----------------------------------------------------------------------------

Link to comment
Share on other sites


Konu Altı Reklam 1
Konu Altı Reklam 2
  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share


×
×
  • Create New...