rename AnytoAny to capital letters and adding package declaration
This commit is contained in:
parent
9ac82a1a26
commit
e6766a92d6
@ -1,7 +1,10 @@
|
||||
package Java.Conversions;
|
||||
|
||||
import java.util.Scanner;
|
||||
//given a source number , source base, destination base, this code can give you the destination number.
|
||||
//sn ,sb,db ---> ()dn . this is what we have to do .
|
||||
public class anytoany {
|
||||
|
||||
public class AnytoAny {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Scanner scn = new Scanner(System.in);
|
||||
@ -9,15 +12,13 @@ public class anytoany {
|
||||
int sb = scn.nextInt();
|
||||
int db = scn.nextInt();
|
||||
int m = 1, dec = 0, dn = 0;
|
||||
while(sn!=0)
|
||||
{
|
||||
while (sn != 0) {
|
||||
dec = dec + (sn % 10) * m;
|
||||
m *= sb;
|
||||
sn /= 10;
|
||||
}
|
||||
m = 1;
|
||||
while(dec!=0)
|
||||
{
|
||||
while (dec != 0) {
|
||||
dn = dn + (dec % db) * m;
|
||||
m *= 10;
|
||||
dec /= db;
|
||||
|
Loading…
Reference in New Issue
Block a user