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
Rasek [7]
3 years ago
9

You are writing a program that defines a variable within a loop, and then tries to use that variable outside the loop. However,

the program does not run as intended. What is the issue?
Computers and Technology
1 answer:
Law Incorporation [45]3 years ago
4 0

Answer:

The Variable is out of scope

Explanation:

In programming variables exists with scopes This could be local or global. When a variable is declared as a global variable it is available to all methods and procedures in the program. Java programming language as well as C++ and several others use the open and close braces to define the scope in programs. consider the following example

<em>public class ANot {</em>

<em>    public static void main(String[] args) {</em>

<em>        int i = 0;</em>

<em>        while ( i<10){</em>

<em>            int sum = 0;</em>

<em>            sum = sum+i;       </em>

<em>        }</em>

<em>    }</em>

<em>}</em>

In this example, the variable i is global and can be assessed within the while loop but the variable sum is local to the while loop and cannot be assessed outside of it

You might be interested in
What are the names of different types of tablets<br>​
jekas [21]

Answer:

iPad

IPad mini

IPad Pro

IPad air

Samsung Galaxy tab

Galaxy Tab e

galaxy tab pro

Galaxy tab 2

Explanation:

Also maybe could you look at my 3 biology questions i really need help

5 0
2 years ago
Write only in C, not C++.
yawa3891 [41]

Answer:

#include <iostream>

using namespace std;

int main() {

  int k;

double d;

string s;

cin >> k >> d >> s;

cout << s << " " << d << " " << k << "\n" << k << " " << d << " " << s; }

                                                                   

Explanation:

k is int type variable that stores integer values.

d is double type variable that stores real number.

s is string type variable that stores word.

cin statement is used to take input from user. cin takes an integer, a real number and a word from user. The user first enters an integer value, then a real number and then a small word as input.

cout statement is used to display the output on the screen. cout displays the value of k, d and s which entered by user.

First the values of k, d and s are displayed in reverse order. This means the word is displayed first, then the real number and then the integer separated again by EXACTLY one space from each other. " " used to represent a single space.

Then next line \n is used to produce a new line.

So in the next line values of k, d and s are displayed in original order (the integer , the real, and the word), separated again by EXACTLY one space from each other.

The program along with the output is attached.

7 0
3 years ago
Which of the following devices are least likely to deny a connection inline when an attack is detected? (select 2)
user100 [1]

Answer: Option (A) & (D) are correct.

Layer 2 switch is commonly referred to as a type of network or device switch that tends to work on data link layer and use MAC addresses in order to determine the route through which the frames are forwarded.

An IDS known as intrusion detection system is commonly referred to as a device or application that controls a network for malevolent activity and its policy violations.

7 0
3 years ago
What happens in Word 2016 when the Home ribbon tab is clicked on?
serg [7]

Answer:

The answar is D.

Explanation:

7 0
3 years ago
it is a program a personal computer microprocessor uses to get the computer system started after you turn it on​
Fofino [41]

Explanation:

please repeat your question

5 0
3 years ago
Other questions:
  • Shakespeare’s complete works have approximately 3.5 million characters. Which is bigger in file size: Shakespeare’s complete wor
    5·2 answers
  • Which of the following is 1000 of a second​
    15·1 answer
  • You resurrected an old worksheet. It appears to contain most of the information that you need, but not all of it. Which step sho
    5·1 answer
  • Digital art is created by using __?
    5·1 answer
  • During the _____ of the systems development life cycle (SDLC), an information system is operating, enhancements and modification
    9·1 answer
  • Which media example would be best for mayas presentation
    7·1 answer
  • Please Help meeeeeeeeeee:
    11·2 answers
  • Which is the correct notation to specify the following inheritance?
    8·1 answer
  • Disadvantages of a grain crusher
    15·1 answer
  • Compare and contrast hardware and software.
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!