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
devlian [24]
2 years ago
8

The iteration variable begins counting with which number? O 0 O 1 O 10 O 0 or 1

Computers and Technology
1 answer:
bonufazy [111]2 years ago
7 0

Answer:

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

Explanation:

The iteration variable begins counting with 0 or 1.

As you know the iteration mostly done in the looping. For example, for loop and foreach loop and while loop, etc.

It depends upon you that from where you can begin the counting. You can begin counting either from zero or from one.

For example: this program counts 0 to 9.

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

<em>for(int i=0; i>10;i++)</em>

<em>{</em>

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

<em>}</em>

Let's suppose, if you want to begin counting from 1, then the loop should look like below:

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

<em>for(int i=1; i>10;i++)</em>

<em>{</em>

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

<em>}</em>

You might be interested in
1. Write a recursive method to determine if a character is in a list of characters in O(logN) time. Mathematically prove (as we
sergeinik [125]

Answer:

1)

public class BinarySearch {

// Returns index of x if it is present in arr[l..

// r], else return -1

int binarySearch(char arr[], int l, int r, char x)

{

if (r >= l) {

int mid = l + (r - l) / 2;

 

// If the element is present at the

// middle itself

if (arr[mid] == x)

return mid;

 

// If element is smaller than mid, then

// it can only be present in left subarray

if (arr[mid] > x)

return binarySearch(arr, l, mid - 1, x);

 

// Else the element can only be present

// in right subarray

return binarySearch(arr, mid + 1, r, x);

}

 

// We reach here when element is not present

// in array

return -1;

}

 

// Driver method to test above

public static void main(String args[])

{

BinarySearch ob = new BinarySearch();

char arr[] = {'a','c','e','f','g','h'};

int n = arr.length;

char x = 'g';

int result = ob.binarySearch(arr, 0, n - 1, x);

if (result == -1)

System.out.println("Character not present");

else

System.out.println("Character found at index " + result);

}

}

2)

import java.io.*;

import java.util.*;

public class Test{

public static boolean checksame(String s)

{

 

Stack<Integer> stack= new Stack<Integer>();

for(int i=0;i<s.length();i++)

{

if(s.charAt(i)=='0')

{

if(stack.empty()==false)

{

if((Integer)stack.peek()==1)

stack.pop();

else

stack.push(0);

}

else

{

stack.push(0);

}

}

else if(s.charAt(i)=='1')

{

if(stack.empty()==false)

{

if((Integer)stack.peek()==0)

stack.pop();

 

else

stack.push(1);

}

else

{

stack.push(1);

}

 

}

}

return stack.empty();

}

public static void main(String []args){

System.out.println(checksame("a0w1220"));

}

}

Explanation:

5 0
3 years ago
Guess The Song: <br> What Popping Brand New Whip Just Hopped In, I Got options
Georgia [21]

Answer:

its called whats poppin lol

Explanation:

:)

7 0
2 years ago
_____ creates a border or space that separates information.
KATRIN_1 [288]
A. Padding
*************
7 0
2 years ago
A _____ miniature battery operated transmitter that can be propelled through a non-metallic pipe or purpose of locating
Anna11 [10]
I think it is the model ET-2. Not quite sure.
7 0
3 years ago
2.24 Write the relevant Python expression or statement, involving a list of numbers lst and using list operators and methods for
miskamm [114]

Answer:

lst = [11, 603, 99, 7, 582, 1];

print("The index of the middle element: " + str(int(len(lst)/2)))

print("The middle element: " + str(lst[int(len(lst)/2)]))

lst.sort()

sorted_lst = lst.reverse()

print("The list in descending order: " + str(lst))

first_number = lst.pop(0)

lst.append(first_number)

print("New lst: "+ str(lst))

Explanation:

- Initialize a list

- Find the middle index, int(len(lst)/2)

- Find the middle element, lst[int(len(lst)/2)]

- Sort the list in descending order (First sort the list in ascending order than reverse it)

- Get the first element using <em>pop</em> method, and append it to the end using <em>append</em> method

- - - - -

a) 0 == 1 == 2 --> Always evaluates false

b) 2 + (3 == 4) + 5 == 7 --> Evaluates true

c) 1 < -1 == 3 > 4 --> Always evaluates false

3 0
3 years ago
Other questions:
  • when seeking information on the on the internet about a variety of subjects the most useful place to look would be?
    13·1 answer
  • Write a program that will askthe user to enter the amount of a purchase. The program should thencompute the state and county sal
    5·1 answer
  • What is used to monitor the activity of a network and notify network administrators when it identifies something as suspicious?
    15·1 answer
  • Why do most laptops have LCD rather than OLED displays, which are found on mobile devices?
    14·1 answer
  • Credence is a student in college.
    13·2 answers
  • Determine what is printed by the following code.
    8·1 answer
  • Write a function check_palindrome that takes a string as an input and within that function determines whether the input string i
    12·1 answer
  • File names should be limited to 144 characters.<br><br> true or false
    12·1 answer
  • Brianna is taking a backpacking trip in the wilderness and wants to back up the photos from her camera. Which type of storage de
    10·1 answer
  • Create a timeline of the evolution of computers and their impact on society
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!