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
lara31 [8.8K]
3 years ago
5

1. For the following program to be executed over the single accumulator

Computers and Technology
1 answer:
AlexFokin [52]3 years ago
6 0

Answer:

The answer to this question is given below in the explanation section.

Explanation:

#include <iostream> // it is preprocessor director that manipulate the input output in the program

using namespace std;// it is used to format input and output

int main() { // main function is started

int x = 5; // variable x is declared and initialized with value 5.

int y = 6; //variable y is declared and initialized with value 6.

int z = 34;  //variable z is declared and initialized with value 34.

int total = (x+(x + y)*z+y); // variable total is declared and initialized with value of x,y,and z. and calculation performed on these value such as (5+(5+6)*34+6) that is equal to 385.

cout << total; // print the value of total variable that is 385

return 0;

}​

You might be interested in
What was the pascaline used for?​
Alex_Xolod [135]

Answer:

Math like multiplication, addition, division, and subtraction

3 0
3 years ago
Assume the variable myWord references a string. Write a statement that uses a slicing
givi [52]

Answer:

"myWord[-5:]"

Explanation:

So whenever you slice a string, the syntax in python is expressed as:

string[a:b:c]

where a=start index (this is included in the sliced string)

b = end index (this is excluded from the sliced string)

c = increment

If any of these are included, they are set to default values, where a=0, b=len(string), and c=1.

The increment isn't necessary here, and it's just so you know the syntax a bit more

Anyways, I'm assuming when the question asks to display "the last 5 characters in the string" it means in order? e.g "abcdefghijk" -> "ghijk" and not "abcdefghijk" -> "kjihg"

The last piece of information to know is what a negative index represents.

For example if I have the piece of code

"

string = "hello world"

print(string[-1])

"

This will output "d", and the negative 1 represents the last letter. If you did -2, it would output the 2nd to last letter and so on.

So to print the last 5 characters, we simply use the -5 as the starting index.  

"

string = "hello world"

print(string[-5:])

"

This will print "world" or in other words, the last 5 letters. The reason for this is because the -5 in the first spot means the starting index is the 5th to last letter, and when you have the : after the -5, this is the way of telling python you're slicing the string, and not indexing 1 character. You don't need to include another value after that, because it will default to the last index of the string, or more specifically the last index + 1, since the last index is still included.

So the last thing to know, is that if the string isn't greater than 5 characters, it just prints the entire string, and no errors are raised. You can test this out your self as well. So whenever you have a string that's less than 5 characters the entire string is outputted.

3 0
2 years ago
what is one example of the decomposers taking from the ecosystem and one of them giving to the ecosystem
adelina 88 [10]
Like when a seed drops on the ground, and a bee come to take some honey. It sticks to the bee and where the bee goes, the bee will rub it off and the seed will start to grow.
8 0
3 years ago
What should be done to make sure the AutoSum feature will use the correct range?
morpeh [17]

Answer:

a

Explanation:

3 0
3 years ago
What does the "e" in eSATA stand for?
dangina [55]
The answer would be b. external. the whole thing means external serial advanced technology attachment 
8 0
4 years ago
Read 2 more answers
Other questions:
  • What is the service provided by a third party (such as an ISP) that enables you to connect another cloud directly to your Google
    15·1 answer
  • GenXTech is a growing company that develops gaming applications for military simulations and commercial clients. As part of its
    8·1 answer
  • Chemical reaction rates are proportional to a rate constant, k, which changes with temperature according to the Arrhenius equati
    14·1 answer
  • A school at which you are likely to be accepted because you meet graduation requirements is called a:
    5·1 answer
  • My friend has 200 subs and i have only 36 can you help me its ACYT ZR
    9·2 answers
  • Write is an I.P.O cycle? Describe with figure​
    5·1 answer
  • A group of users in a small publishing office want to share large image files in a common folder with high availability. Which o
    15·1 answer
  • In java I need help on this specific code for this lab.
    5·1 answer
  • Programming Cycle. Arrange them in correct order​
    5·2 answers
  • What is a symbol such as a heavy dot or another character that precedes a text in a power point
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!