Skip to content

Commit dc5ae2d

Browse files
authored
Update BinaryToDecimal.java
Changed bin_num and bin_copy to binNum and binCopy respectively.
1 parent 1c3490d commit dc5ae2d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Conversions/BinaryToDecimal.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ class BinaryToDecimal {
1515
*/
1616
public static void main(String args[]) {
1717
Scanner sc = new Scanner(System.in);
18-
int bin_num, bin_copy, d, s = 0, power = 0;
18+
int binNum, binCopy, d, s = 0, power = 0;
1919
System.out.print("Binary number: ");
20-
bin_num = sc.nextInt();
21-
bin_copy = bin_num;
22-
while (bin_copy != 0) {
23-
d = bin_copy % 10;
20+
binNum = sc.nextInt();
21+
binCopy = binNum;
22+
while (binCopy != 0) {
23+
d = binCopy % 10;
2424
s += d * (int) Math.pow(2, power++);
25-
bin_copy /= 10;
25+
binCopy /= 10;
2626
}
2727
System.out.println("Decimal equivalent:" + s);
2828
sc.close();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy