1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
pentagon [3]
2 years ago
13

write a function that given an integer n returns the smallest integer greater than n the sume of whose digits is twice as big th

e as the sum of digits of N
Computers and Technology
1 answer:
USPshnik [31]2 years ago
3 0

The code below is written in javascript which gives us the integer,

<h3>The function code is</h3>

function solution (num){


//Javascript function


var x=0,sum=0,a,b;


var d=""; //variable declaration


var digits = num.toString().split('');


var Individual = digits.map(Number);


//console.log(Individual);


for (var i=0;i<Individual.length;i++)


{//For loop


x=x+Individual[i];


}


var y=x*2;


for(var i=0;i<Individual.length;i++)


{


sum=sum+Individual[i];


d=""+d+Individual[i];


if(sum==y)


break;


if(i==Individual.length-1)


{


i=-1;


continue;


}


}


console.log("the value is "+d);


}


var number = prompt("enter the number");


//Asking user for value...


console.log("the number is");


console.log(number);


solution(num

For more information on javascript, visit

brainly.com/question/16698901?referrer=searchResults

You might be interested in
Which of the following savings vehicles usually requires a high minimum balance
GuDViN [60]
A Savings Vehicle is an effective way to hold your savings. It could be a savings account. But some requires a high minimum balance such as Certificate of Deposit (CD). It is generally issued by commercial banks.  It is a time deposit too and restricts you from withdrawing funds.
7 0
3 years ago
Into which of these files would you paste copied information to create an integrated document? A. Mailing list B. Source C. Data
viva [34]

it would be b.mailing list


5 0
3 years ago
Read 2 more answers
Which structures protect the cell? Select two options.
Rzqust [24]

Answer:

cell wall

cell membrane

3 0
1 year ago
What are the advantage of an e-library​
Semmy [17]

Answer:

Makes it easier to read... summarize cite electronic versions of editions

3 0
1 year ago
What imaging test can tell the speed and direction of blood
Sindrei [870]
A doppler ultrasound
8 0
3 years ago
Other questions:
  • 1) why is software engineering considered engineering and not manufacturing?
    9·1 answer
  • Select the focus questions that emphasizes what is more important: (Select all that apply) a.What needs to be relegated to the b
    8·1 answer
  • What does ADF means????
    13·2 answers
  • Name the hardware component that performs each of the following functions (1) performs calculation and/or comparisons (2) holds
    9·1 answer
  • Solve the recurrence relation.<br> S(1)=1<br> S(n)= S(n-1)+(2n-1) for n&gt;=2
    13·1 answer
  • Concentric circles on a disk platter where data is stored;________
    8·1 answer
  • Is this statement true or false?
    13·2 answers
  • Limitations of systems analysis and design​
    13·1 answer
  • What changes could you make so that a message, "User input deemed invalid." during designing a simple calculator program for you
    8·1 answer
  • What are the two compatibility issues that may arise between computer systems while transferring presentations? different video
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!