Question

In R programming: Debug the below code. counter = 0 while {counter > 100} if (counter...

In R programming: Debug the below code.

counter = 0 while {counter > 100}

if (counter %% 2 = 1)

print(paste(counter," is odd"))

else

print(paste(counter," is odd"))

counter = counter + 1

0 0
Add a comment Improve this question Transcribed image text
Answer #1
counter = 0 
while (counter < 100){
if (counter %% 2 == 1)
    print(paste(counter," is odd"))
else
    print(paste(counter," is odd"))
counter = counter + 1
}
Add a comment
Know the answer?
Add Answer to:
In R programming: Debug the below code. counter = 0 while {counter > 100} if (counter...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Consider the following code segment: int[][] mystery = new int[3][3]; int counter = 0; while(counter <...

    Consider the following code segment: int[][] mystery = new int[3][3]; int counter = 0; while(counter < mystery.length) { for(int col = 0; col < mystery[counter].length; col++) { if(counter == 0) { mystery[col][counter] = 1; } else if(counter == 1) { mystery[counter][col] = 2; } else { mystery[counter][counter] = 3; } } counter++; } What will the value of each element in mystery be after the execution of the code segment? a) {{1, 0, 0} {2, 2, 2} {1, 0, 3}}...

  • Create a while loop that will execute the following code 12 times using a counter that...

    Create a while loop that will execute the following code 12 times using a counter that starts at 1 and is incremented by 1 each time through the loop. Within the while loop, create a switch statement that will print out the number of days in each of the months of the year. - Use fall through capabilities so that you only have one print statement for all of the months that contain 31 days. Do not worry about leap...

  • Debug the following java code so that it will have given out put at the bottom....

    Debug the following java code so that it will have given out put at the bottom. Make sure to fix all syntax and logical errors. import java.util.Scanner; public class Graphs { // draws 5 histograms public void drawHistograms() Scanner input = new Scanner( System.in ); int number1 = 0; // first number int number2 = 0; // second number int number3 = 0; // third number int number4 = 0; // fourth number int number5 = 0; // fifth number...

  • Use Modelsim to debug and compile a while loop statement syntax: while (< expression >) <...

    Use Modelsim to debug and compile a while loop statement syntax: while (< expression >) < statement > module while_example (); reg [5:0] location; reg [7:0] data; always @ (data or location) begin location = 0;//If Data is 0, then location is 32 (invalid value) if (data == 0) begin location = 32; end else begin while (data [0] == 0) begin location = location + 1; data = data >> 1; end end $display ("DATA = %b LOCATION =...

  • For this lab, modify the python code below so it will continuously be asking user for...

    For this lab, modify the python code below so it will continuously be asking user for inputs to calculate the interest earned until the user enters number 0 (zero) in principle. Once the user enters any number less or equal to 0 in principle, the program will end. here is my code: # Programming Exercise 3-14 # Local variables p = 0.0 r = 0.0 n = 0.0 t = 0.0 loop = True while loop: p = float(input('\nEnter the...

  • this code is not working for me.. if enter 100 it is not showing the grades...

    this code is not working for me.. if enter 100 it is not showing the grades insted asking for score again.. #Python program that prompts user to enter the valuesof grddes . Then calculate the total scores , #then find average of total score. Then find the letter grade of the average score. Display the #results on python console. #grades.py def main(): #declare a list to store grade values grades=[] repeat=True #Set variables to zero total=0 counter=0 average=0 gradeLetter='' #Repeat...

  • JAVA Programming Add debug statements to the Java code in Question 1 to show the list...

    JAVA Programming Add debug statements to the Java code in Question 1 to show the list values after each completing cycle of the sorting process. Run your program with an array of size 10 {27,28,9,6,15,18,33,30,-4,-1} and complete the following tables. Add rows to the tables if you need them. Cycle Bubble Sort 0 27 28 9 6 15 18 33 30 -4 -1 1 27 9 6 15 18 28 30 -4 -1 33 2 3 4 5 6 7...

  • python programming Which of the following code will print all odd numbers between 3 and 11,...

    python programming Which of the following code will print all odd numbers between 3 and 11, each number separated by a space as shown below 35 7 9 11 for i in range(3, 11, 1): if 1%2 ID: print(i, end = " for i in range(3, 10, 2): print(i, end = for i in range, 11, 2): if 152 == 0: print(i, end = "") for i in range 12, 1): print(i, end = "")

  • Please explain the python code below L1 = [2, 15, 'Carol', 7.4, 0, -10, -6, 42,...

    Please explain the python code below L1 = [2, 15, 'Carol', 7.4, 0, -10, -6, 42, 27, -1, 2.0, 'hello', [2, 4], 23] print("L1 =",L1) odds =[] evens=[] list=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',',','.'] no=0 for i in L1: i=str(i) for j in list: if i.find(j)>=0: no=1 if no==1: None else: i=int(i) if i%2==0: evens.append(i) else: odds.append(i) no=0      ...

  • I'm trying to run the code in Python below and keep getting invalid syntax. What's wrong?...

    I'm trying to run the code in Python below and keep getting invalid syntax. What's wrong? Thanks for any help! def even(n): if n%2==0 #Enter a Number def main(): n=int(input("Enter a number: ")) #If even print "Number is even" if(even(n)): print("The number is even") #If odd print "Number is odd" else: print("The number is odd") main() #Call the main function

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT