Question

how to write this code matlab

Write a program (using break statement) that makes the computer prompt you to enter the password (say password is Brave) unti

0 0
Add a comment Improve this question Transcribed image text
Answer #1
count = 0;
password = "Brave";

while true
    s = input("Enter password: ", "s");
    count = count+1;
    if strcmp(s, password)
        break;
    end
    fprintf("Incorrect. Try again!\n")
end

fprintf("\nYou guessed %d times in total\n", count)



\color{blue}Please\;let\;me\;know\;if\;you\;have\;any\;doubts\\ Please\;upvote\;this\;answer.\;\;Thanks!!

Add a comment
Know the answer?
Add Answer to:
how to write this code matlab Write a program (using break statement) that makes the computer...
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
  • Looking for code in MATLAB: A store owner asks you to write a program for use...

    Looking for code in MATLAB: A store owner asks you to write a program for use in the checkout process. The program should: Prompt the user to enter the cost of the first item Continue to prompt for additional items, until the user enters 0 Display the total. Prompt for the dollar amount the customer submits as payment. Display the change due.

  • I have provided below the problem statement for the assignment, the code should be written in MatLab: Write a computer p...

    I have provided below the problem statement for the assignment, the code should be written in MatLab: Write a computer program that takes as input an angle and the components of a position vector in frame

  • Write the Code in C program. Create a random password generator that contains a user-specified number...

    Write the Code in C program. Create a random password generator that contains a user-specified number of characters. Your program should prompt the user for the desired length of the password. Length of password: To create your password, use the random number generator in the stdlib.h C library. To generate random numbers, you will need the srand() and rand() functions. srand(seed) is used to "seed" the random number generator with the given integer, seed. Prompt the user for the seed...

  • x= Suppose you are building a program for teaching kids' math. Write a java program the...

    x= Suppose you are building a program for teaching kids' math. Write a java program the does the following: 1. Ask the user if he/she wants to sign-up a. If yes continue to step 2 b. If no Display the message "Thank you, Have a nice Day 2. Ask the user to enter a username. 3. Ask the user to enter a password with at least 8 characters long 4. Write a method with the following header: public static Boolean...

  • Using MATLAB (a) Write a computer program capable of zooming and shrinking an image by pixel...

    Using MATLAB (a) Write a computer program capable of zooming and shrinking an image by pixel replication. Assume that the desired zoom/shrink factors are integers. - Ask a user to choose a picture - Ask the user to enter the factor - The factor must be an integer - Use if- statement it the user wants to zoom or shrink. - Make the user re-enter if he/ she doesn't enter the factor number as an integer.

  • Write a MATLAB code for the hangman game below you might break the problem down into:...

    Write a MATLAB code for the hangman game below you might break the problem down into: Selecting a word from a dictionary. ‘aardvark’ Reading a single letter from the user like ‘a’ Building a character array showing the letters matched so far like ‘aa---a--’ Keeping count of the number of guessed letters so far. Keeping count of the number of guesses so far. Writing conditional logic to see whether the game is finished or not.

  • For this lab you will write a Java program using a loop that will play a...

    For this lab you will write a Java program using a loop that will play a simple Guess The Number game. Th gener e program will randomly loop where it prompt the user for a ate an integer between 1 and 200 (including both 1 and 200 as possible choices) and will enter a r has guessed the correct number, the program will end with a message indicating how many guesses it took to get the right answer and a...

  • Please use matlab to code this program. Write a computer program that takes as input an angle β and the components of a...

    Please use matlab to code this program. Write a computer program that takes as input an angle β and the components of a position vector in frame A (i.e. r). The transformation from frame A to frame B is a rotation about the 1-axis. Your code should calculate the DCM CAB, and the components of the vector in frame B (i.e.rB. Your code should output all of the following, including a label and units (if applicable) for each: CAB 4.8...

  • Can you add code comments where required throughout this Python Program, Guess My Number Program, and...

    Can you add code comments where required throughout this Python Program, Guess My Number Program, and describe this program as if you were presenting it to the class. What it does and everything step by step. import random def menu(): #function for getting the user input on what he wants to do print("\n\n1. You guess the number\n2. You type a number and see if the computer can guess it\n3. Exit") while True: #using try-except for the choice will handle the...

  • Java Programming Write a program that will help a student learn multiplication. Use SecureRandom object to...

    Java Programming Write a program that will help a student learn multiplication. Use SecureRandom object to produce two positive integers between 1 and 20. The program should then prompt the user with a question (use a sentinel-controlled loop), such as: How much is 10 times 11? The student then inputs the answer. If the answer is correct display the message “very good” and ask another question. If the answer is wrong to display the message “no, please try again” and...

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