write a java program to convert octal to binary????
Mai sirf tumse SORRY bolke DOSTI karna chata tha..............Pr tumne to phele hi mana krdiya tha.........isliye nahi bolna chata tha waha.......aur vo sala moderator bhi tha waha isliye nahi bola tha
Nahi ata to bata deta hu unblock kaise karte hai.....
Mere ACCOUNT pe jao.......waha likha hoga WRITE MESSAGE.........waha CLICK KARO..........jo inbox khul jayega........frr wha alikha hoga unblock to krdena...................
Answers
Answered by
0
class Octal_Binary
{
Scanner scan;
int num;
void getVal()
{
System.out.println("Octal to Binary");
scan = new Scanner(System.in);
System.out.println("\nEnter the number :");
num = Integer.parseInt(scan.nextLine(), 8);
}
void convert()
{
String binary = Integer.toBinaryString(num);
System.out.println("Binary Value is : " + binary);
}
}
class MainClass
{
public static void main(String args[])
{
Octal_Binary obj = new Octal_Binary();
obj.getVal();
obj.convert();
}
}
{
Scanner scan;
int num;
void getVal()
{
System.out.println("Octal to Binary");
scan = new Scanner(System.in);
System.out.println("\nEnter the number :");
num = Integer.parseInt(scan.nextLine(), 8);
}
void convert()
{
String binary = Integer.toBinaryString(num);
System.out.println("Binary Value is : " + binary);
}
}
class MainClass
{
public static void main(String args[])
{
Octal_Binary obj = new Octal_Binary();
obj.getVal();
obj.convert();
}
}
Answered by
0
import java.util.*;
public class octal
{
public static void main(String args[])
{
int oct, rem, quot, i=1, j;
int binnum[] = new int[100];
Scanner scan = new Scanner(System.in);
System.out.print("Enter Octal Number : ");
oct = scan.nextInt();
quot = oct;
while(quot != 0)
{
bin[i++] = quot%2;
quot = quot/2;
}
System.out.print("Equivalent Binary Value of " +octnum+ " is+n);
for(j=i-1; j>0; j--)
{
System.out.print(bin[j]);
}
}
Similar questions
Maine vi nahi kiya tha......Manna hai mannajao