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
When you select Insert and click on a shape the mouse pointer turns into a/an
Gennadij [26K]

It turns into crosshairs

6 0
3 years ago
Read 2 more answers
In addition to MLA, what are some other widely used style guides? Check all that apply.
Lostsunrise [7]
APA and Chicago manual of style :D
6 0
3 years ago
Read 2 more answers
Different units of CPU ?
deff fn [24]
The two typical components of a CPU include the following:<span>--The arithmetic logic unit (ALU), which performs arithmetic and logical operations. --<span>The control unit (CU), which extracts instructions from memory and decodes and executes them, calling on the ALU when necessary.</span></span>
3 0
3 years ago
Why do we use console.log in javascript when changing variables?
Fiesta28 [93]
It helps to debug the code. Instead of going through every line of code to find an error, using console.log can tell us where to look.
8 0
3 years ago
Read 2 more answers
How do you think computers have helped to improve documentation, support and services within the healthcare industry.
AfilCa [17]
Before the use of technology such as computers, information was documented through papers separated in folders. This was a very long and complicated process as people would have to find information by hand, sorting through countless documents. Now, it is much easier and neater to keep information. It can be as easy as digitally searching for someone's name and the computer will sort through countless documents, finding the one you need almost instantly. It is also much less wasteful and safe, as before computers, the use of paper was the only way to permanently keep information, also making documents vulnerable to being lost or stolen.
4 0
3 years ago
Other questions:
  • In the lab, you performed an asset identification and classification exercise by creating a(n) __________ organized within the s
    10·1 answer
  • Num = int(input("Enter a number: "))
    5·2 answers
  • Which key removes all data from an active cell with one click? A. Esc B. Delete C. Tab D. F2
    9·2 answers
  • Nina is trying to learn more about how computers work. She has repeatedly read that the motherboard is the "brain” of the comput
    9·2 answers
  • Su
    6·1 answer
  • ___ is a family of data formats that helps people automatically receive feeds anytime there are new postings to their favorite b
    14·1 answer
  • Python Question Class 11 attached below
    9·1 answer
  • Inappropriate use of technology makes it easier for cyber bullies to <br> others.
    13·2 answers
  • Why would a programmer use the logical operator or in an if statement? (5 points)
    14·1 answer
  • Pieter is a network administrator for a growing company and has decided to implement Kerberos. He knows that Kerberos uses a tic
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!