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
Write an expression that computes the integer average of the int variables exam1 and exam2 (both declared and assigned values).
Minchanka [31]

Answer:

#include <iostream>

using namespace std;

int main()

{

   int exam1 = 70;

   int exam2 = 85;

   int examAverage;

   examAverage = (exam1+exam2)/2;

   cout <<"The Average of Exam1 and Exam2 is: "<<examAverage<<endl;

   return 0;

}

Explanation:

Using the C++, we declare the three variables all of type

exam1

exam2 and

examAverage

We assign initial values of 70 and 85 to exam1 and exam2 respectively

7 0
3 years ago
Fill in this function that takes three parameters, two Strings and an int. 4- // Write some test function calls here! The String
zimovet [89]

Answer:

The function in Java is as follows:

public static void printMessage(String lineOne, String lineTwo, int lines){

       for(int i = 1;i<=lines;i++){

           if(i%2 == 1){

               System.out.println(lineOne);

           }

           else{

               System.out.println(lineTwo);

           }

       }

   }

Explanation:

This defines the function

public static void printMessage(String lineOne, String lineTwo, int lines){

This iterates through the number of lines

       for(int i = 1;i<=lines;i++){

String lineOne is printed on odd lines i.e. 1,3,5....

      if(i%2 == 1){

               System.out.println(lineOne);

           }

String lineTwo is printed on even lines i.e. 2,4,6....

           else{

               System.out.println(lineTwo);

           }

       }

   }

To call the function from main, use:

printMessage("Hi", "Karel", 5);

8 0
3 years ago
Suppose I create a new kind of Java object, called "Kangaroo". Further suppose that at any given time, all instances of this new
OLEGan [10]

Answer:

Attributes.

Explanation:

When the java object is created called "Kangaroo" and it has some properties or facts associated  with it that includes the stomach capacity,current attitude towards the pea soup and the kangaroo's location.The another name of these facts is Attributes.

Attributes are the qualities,features or properties that an entity possesses.

4 0
3 years ago
What is the name of the nearest major galaxy to Milky-Way ?
nika2105 [10]
The Andromeda Galaxy would be my answer.
3 0
3 years ago
True or false? any webb app can be accessed and run on any computing
Mademuasel [1]

Answer:

B. False

Explanation:

A web application is a computer program that  works over the internet. So, in order to access and run it you need a web browser and this will also require to have an internet access. If you don't have one of these you will not be able to run the app.

6 0
3 years ago
Other questions:
  • bj;ljfg'cfmb dfl kbslf jflk[gkdblkfd lbrkjlfbbfkjbdfjkbadbjbbkvbk'lbk'blbf;l;lkb lm;flklmkjlvkljvkljvbfbdsjsfbbjjlkbfjklbkfj'lgg
    9·2 answers
  • Write a definition of the function printDottedLine, which has no parameters and doesn't return anything. The function prints to
    14·1 answer
  • All computers perform disk optimization utilizing the same software.<br><br> true <br> false
    11·1 answer
  • Which of the following is true regarding data analysis? a. Disciplines and professions do not provide guidance on data analysis.
    6·2 answers
  • Clicking the ____ opens the insert function dialog box.
    13·1 answer
  • What is the value of the variable result after these lines of code are executed?
    11·1 answer
  • Using the Insert tab, you can convert text into a table and a table into text.
    15·1 answer
  • Describe the main roles of the communication layer, the network-wide state-management layer, and the network-control application
    15·1 answer
  • Because travel distance, cost of living, and other factors vary among the three regions, the annual cost of having a salesperson
    14·1 answer
  • A while loop is frequently used to ______________ data.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!