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
Diano4ka-milaya [45]
3 years ago
8

[This is on Edhesive (coding and programming)]

Computers and Technology
2 answers:
Ghella [55]3 years ago
6 0

Answer:

Codes are given below:

Explanation:

Since the language is not specified, I am writing it in c++

1) Ask the user to input an integer. Print out the next three consecutive numbers.

#include <iostream>

 using namespace std;

 int main()    //Start of main function

{

  int number;  

   cout << "Enter your number<<endl;

  cin >> number;     //this will take your number as an input

 

  cout <<"The next three numbers are: " << number + 1 << endl;

  cout << number + 2 << endl;

   cout << number + 3 << endl;  

  return 0;

}   //End of main function

2) Write a program that accepts three decimal numbers as input and outputs their sum.

#include <iostream>

 using namespace std;

 int main()    //Start of main function

{

  int number1, number2, number3;  

   cout << "Enter your three numbers<<endl;

  cin >> number1 >> number2>> number3 ;     //this will take your three number as an input

 

  cout <<"The sum of three numbers are: " << number1 + number2+ number3 <<  endl;  

  return 0;

}   //End of main function

egoroff_w [7]3 years ago
6 0

The code is written using Python language as it is one of the programming languages introduced by the Edhesive courses.

Answer (Question 1):

  1. num = int(input("Input an integer: "))
  2. for i in range(1, 4):
  3.    print(num + i)

Explanation (Question 1):

<u>Line 1 : </u>

Prompt user for input an integer.  In Python we can easily use <em>input </em>method to ask user for an input.

However the default data type of the input is a string and therefore we need to enclose our input value within <em>int()</em> to convert the value from string to integer.

<u>Line 3 - 4:</u>

Create a for-loop to loop though the code in Line 4 for three times using the <em>range() </em>function. The <em>range(1, 4) </em>will return a list of numbers, [1, 2, 3] .

In each round of the loops, one number from the list will be taken sequentially and total up with the input number, num and display using <em>print()</em> function.

Answer (Question 2):

  1. counter = 3
  2. sum = 0
  3. while (counter > 0):
  4.    num = float(input("Enter a decimal number: "))
  5.    sum += num
  6.    counter = counter - 1
  7. print("The sum is " + str(sum))

Explanation (Question 2):

<u>Line 1 - 2 :</u>

Create a <em>counter</em> variable and a <em>sum</em> variable and initialize them with 3 and 0, respectively.

<u>Line 4:</u>

Create a <em>while </em>loop and set a condition while counter is bigger than zero, the loop should keep running the code from Line 5-7.

<u>Line 5:</u>

Use <em>input</em> function again to prompt user for a decimal number. This time we need to use<em> float </em>function to convert the input value from string to decimal data type.

<u>Line 6:</u>

Every time when a decimal number is input, the number is added to the <em>sum</em> variable.

<u>Line 7:</u>

Decrement the counter variable by 1. This step is important to ensure the while loop will only be repeated for three times and each loop will only accept one input value from user.

<u>Line 9</u>

Display the sum.

You might be interested in
I need help on this, need answer asap.
FinnZ [79.3K]

Answer:

int main() {

int _2dArray[32][32];

for (int i = 0; i < 32; i++) {

 for (int j = 0; j < 32; j++) {

  _2dArray[i][j] = j + i * 32;

 }

}

return 0;

}

Explanation:

Here is a generic C/C++ 2d array traversal and main function example. The rest you'll have to figure out based on what kind of app you're making.

Good luck!

6 0
2 years ago
2
Elza [17]

A is the correct answer.

Hope this helps you!

3 0
3 years ago
Read 2 more answers
_______ is a variation of phishing that uses voice communication technology to obtain the information the attacker is seeking.
Zanzabum
It's voice phishing but it's also sometimes referred to as vishing 
4 0
2 years ago
What key is in the upper-left corner of the keyboard?? ​
Marianna [84]

AnswertabAnswer:

(ESC) Escape

Explanation:

The function of this keyboard key is to escape the current t view or mouse inversion you are on, or it could be used as a keyboard shortcut when used with other keys.

7 0
2 years ago
The Beaufort Wind Scale is used to characterize the strength of winds. The scale uses integer values and goes from a force of 0,
joja [24]

Answer:

The equivalent if statements is:

ranforce = randi([0, 12]);

if (ranforce == 0)

     disp('There is no wind')

else  if(ranforce>0 && ranforce <7)

     disp('There is a breeze')

else  if(ranforce>6 && ranforce <10)

     disp('This is a gale')

else  if(ranforce>9 && ranforce <12)

     disp('It is a storm')

else  if(ranforce==12)

     disp('Hello, Hurricane!')

end

Explanation:

<em>The solution is straight forward.</em>

<em>All you need to do is to replace the case statements with corresponding if or else if statements as shown in the answer section</em>

4 0
2 years ago
Other questions:
  • Productivity software has been used for a number of years. Recent advancements in productivity software technology have made ___
    14·1 answer
  • You listened to a song on your computer. Did you use hardware or software? Explain.
    11·2 answers
  • A pair of single quotes ' will prevent the shell from interpreting any special character. True or False
    15·1 answer
  • Translation of a file into a coded format that occupies less space than the original file is called
    15·1 answer
  • It’s been six months since the disk crash at CSM Tech Publishing, and the owner is breathing a little easier because you install
    7·1 answer
  • Running the Disk Cleanup utility is a quick way to ________. Group of answer choices defrag your hard drive remove spyware progr
    10·1 answer
  • Which of the following is NOT a file format used for word processing documents? A. .ppt B. .rtf C. .doc D. .odt
    5·1 answer
  • We can improve our knowledge and skills on animals and fish raising with the use of internet​
    15·1 answer
  • Who was making the high-pitched growling noise that Francisco hears?
    9·1 answer
  • Network forensic analysis. A network forensic analyst is responsible for identifying worms, viruses, and infected nodes in the c
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!