🔒 Closed Binary to ascii

Status
Not open for further replies.
Inisang Class ko nalang sya :)

import java.util.Scanner;

public class AssciiCoding {


public static void main (String args []) {
Scanner sc = new Scanner(System.in);


System.out.println("Binary into Characters");
System.out.print("Enter Binary:");
String binary = sc.nextLine();

//Binary to Character
int br = Integer.parseInt(binary,2);
char ch = (char)br;
System.out.println("Character with Binary code "+binary+" is "+ch);

//Character to ASCII
int ascii = (int)ch;
System.out.println("ASCII code of character "+ch+" is "+ascii);

//ASCII to Binary
String fBr = Integer.toBinaryString(ascii);
System.out.println("Binary code of ASCII code "+ascii+" is "+fBr);
}

}

upload_2019-1-26_11-36-56.png
 
Inisang Class ko nalang sya :)

import java.util.Scanner;

public class AssciiCoding {


public static void main (String args []) {
Scanner sc = new Scanner(System.in);


System.out.println("Binary into Characters");
System.out.print("Enter Binary:");
String binary = sc.nextLine();

//Binary to Character
int br = Integer.parseInt(binary,2);
char ch = (char)br;
System.out.println("Character with Binary code "+binary+" is "+ch);

//Character to ASCII
int ascii = (int)ch;
System.out.println("ASCII code of character "+ch+" is "+ascii);

//ASCII to Binary
String fBr = Integer.toBinaryString(ascii);
System.out.println("Binary code of ASCII code "+ascii+" is "+fBr);
}

}

View attachment 543200
Maraming salamat paps
 
Status
Not open for further replies.

About this Thread

  • 3
    Replies
  • 664
    Views
  • 2
    Participants
Last reply from:
OdenDi

Trending Topics

Online now

Members online
354
Guests online
2,369
Total visitors
2,723

Forum statistics

Threads
2,316,222
Posts
29,185,753
Members
1,182,857
Latest member
Tearsli
Back
Top