Question

In: Computer Science

A = [-1000:1:1000] write a script file that gives the positive numbers greater than 480 and...

A = [-1000:1:1000] write a script file that gives the positive numbers greater than 480 and divisible by 3. Hint: Use this command if A(i)>480&&(rem(A(i),3)==0) and indeed, if is always accompanied by an end

Solutions

Expert Solution



___________________________________________________________________

% populare array with number
% ranging from -1000 to 1000
A=[-1000:1:1000];

% positive numbers greater than
%  480 and divisible by 3
B=A(A >480 & rem(A, 3)==0);

% display the numbers which satisfies 
% the condition
disp(B)

________________________________________________________________

Columns 1 through 22

   483   486   489   492   495   498   501   504   507   510   513   516   519   522   525   528   531   534   537   540   543   546

  Columns 23 through 44

   549   552   555   558   561   564   567   570   573   576   579   582   585   588   591   594   597   600   603   606   609   612

  Columns 45 through 66

   615   618   621   624   627   630   633   636   639   642   645   648   651   654   657   660   663   666   669   672   675   678

  Columns 67 through 88

   681   684   687   690   693   696   699   702   705   708   711   714   717   720   723   726   729   732   735   738   741   744

  Columns 89 through 110

   747   750   753   756   759   762   765   768   771   774   777   780   783   786   789   792   795   798   801   804   807   810

  Columns 111 through 132

   813   816   819   822   825   828   831   834   837   840   843   846   849   852   855   858   861   864   867   870   873   876

  Columns 133 through 154

   879   882   885   888   891   894   897   900   903   906   909   912   915   918   921   924   927   930   933   936   939   942

  Columns 155 through 173

   945   948   951   954   957   960   963   966   969   972   975   978   981   984   987   990   993   996   999

___________________________________________________________________


Note: If you have queries or confusion regarding this question, please leave a comment. I would be happy to help you. If you find it to be useful, please upvote.


Related Solutions

To find a positive root for , write a MATLAB script file that uses Bisection method....
To find a positive root for , write a MATLAB script file that uses Bisection method. Choose any initial value that is needed. Use absolute relative approximate error to be less than 0.01. Your code should report the number of iteration and the value of x.
Write following program using Python: A positive integer greater than 1 is said to be prime...
Write following program using Python: A positive integer greater than 1 is said to be prime if it has no divisors other than 1 and itself. A positive integer greater than 1 is composite if it is not prime. Write a program that asks the user to enter a integer greater than 1, then displays all of the prime numbers that are less than or equal to the number entered. Last, create two files. One file will hold all of...
write a script file that calculated the first n perfect numbers. use the WHILE structure the...
write a script file that calculated the first n perfect numbers. use the WHILE structure the perfect number is a positive integer that is equal to the sum of its multiples for example 6 is a perfect number since it’s multiplied are 1, 2 and 3. 1+2+3=6 the result must be stored in a vector where all calculated perfect numbers appear. you must use the rem command matlab
Python Create a Python script file called hw3.py. Ex. 1. Write a program that inputs numbers...
Python Create a Python script file called hw3.py. Ex. 1. Write a program that inputs numbers from the user until they enter a 0 and computes the product of all these numbers and outputs it. Hint: use the example from the slides where we compute the sum of a list of numbers, but initialize the variable holding the product to 1 instead of 0. print("Enter n") n = int(input()) min = n while n != 0: if n < min:...
Write a C++ program to allow a user to enter in any positive number greater than...
Write a C++ program to allow a user to enter in any positive number greater than or equal to zero. The program should not continue until the user has entered valid input. Once valid input has been entered the application will determine if the number is an abundant number or not and display whether or not the number is an abundant number. If the user enters in a 0 the program should quit. An abundant number is a number n...
Windows PowerShell 1) Write a PowerShell Script to monitor a file for changes. 2) Write a...
Windows PowerShell 1) Write a PowerShell Script to monitor a file for changes. 2) Write a PowerShell Script to create a user account in a specific OU.
1) How many positive integers are greater than 140, less than 30800 and relatively prime to...
1) How many positive integers are greater than 140, less than 30800 and relatively prime to 280.
Write a script that prompts the user for a pathname of a file or directory and...
Write a script that prompts the user for a pathname of a file or directory and then responds with a description of the item as a file along with what the user's permissions are with respect to it (read, write, execute).
Create a bash script file named assessment-script-a that: 1. Accepts any number of file names on...
Create a bash script file named assessment-script-a that: 1. Accepts any number of file names on the command line 2. For each file name provided, delete any line that contains the string: qwe.rty When the changes are completed, the script should display the total number of files scanned, and the total number of files changed. Example Command: assessment-script-a file.a file.b file.c file.d file.e    Example Output: 5 files scanned, 3 files changed 3. Your script should include a series of...
Write a bash script file that tests each file entry in the current directory. It should...
Write a bash script file that tests each file entry in the current directory. It should determine if it is a file or directory. If it is a file, it will determine if it is readable or not. If it is readable, it will display only the first 4 lines to the terminal in sorted order (just sort the first 4 lines). If it is a directory, it should display the contents of that directory (the files and subdirectories). NOTE:...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT