Help Writing Java Program Following Given Integers N B Greater 1 Find Base B Expansion Int Q37258285

help writing a java program that will do the following; Givenintegers n and b, each greater than 1, find the base b expansion ofthis integer.

n=777; b=8

Ex: (777)8=7·82+7·81+7·80=511


Answer


import java.util.Scanner;public class Main { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); System.out.println(“Enter value for n: “); int n = scanner.nextInt(); System.out.println(“Enter value for b: “); int b = scanner.nextInt(); int res = 0; int t = 1; while(n>0){

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.