Shell Script: Write a shell script that will count all the even numbers, and prime numbers found in a series of numbers that the user will specify. Your will ask the user to enter a lower bound and an upper bound, and then output the number of even numbers found. The formula for the number of possible Permutations of r objects from a set of n is usually written as nPr. Where nPr = n!/(n-r)!. Write a shell script program to implement the combination of Pr. You will ask the user to enter the values of both r and n and then print the value of nPr. a

Answers

Answer 1

Here's a shell script that will count all the even numbers and prime numbers found in a series of numbers specified by the user:

bash

#!/bin/bash

echo "Enter lower bound:"

read lower_bound

echo "Enter upper bound:"

read upper_bound

even_count=0

prime_count=0

for (( num=$lower_bound; num<=$upper_bound; num++ )); do

   # Check if number is even

   if (( $num % 2 == 0 )); then

       even_count=$((even_count+1))

   fi

   # Check if number is prime

   prime=true

   for (( i=2; i<$num; i++ )); do

       if (( $num % $i == 0 )); then

           prime=false

           break

       fi

   done

   if $prime && (( $num > 1 )); then

       prime_count=$((prime_count+1))

   fi

done

echo "Number of even numbers found: $even_count"

echo "Number of prime numbers found: $prime_count"

And here's a shell script program to implement the combination of Pr, which takes user input values of r and n and prints the value of nPr:

bash

#!/bin/bash

echo "Enter value of r:"

read r

echo "Enter value of n:"

read n

nPr=$(echo "scale=0; factorial($n)/factorial($n-$r)" | bc -l)

echo "nPr = $nPr"

Note that the second script uses the bc command-line calculator to compute factorials. The scale=0 option sets the number of decimal places to zero, and the -l option loads the standard math library needed for the factorial() function.

Learn more about script here

https://brainly.com/question/28447571

#SPJ11


Related Questions

Aika has several labeled folders for different parts of his research. What is the MOST likely reason he does this? He wants to make sure that all of the topics are researched equally. He wants to avoid accidentally forgetting to research one of the topics. He wants to easily and quickly find specific bits of research that cover certain topics. He wants to make his research easier to read than it would otherwise be.

Answers

Answer:

He wants to easily and quickly find specific bits of research that cover certain topics.

Explanation:

Remember, a research work typically has these 6 (six) components:

The Abstract.IntroductionMethodologyResultsDiscussionReferences.

Thus, Aika's decision to label several folders for different parts of his research would make it easier and quicker for him to find specific bits of research that cover certain topics, instead of spending time looking for topics.

what is the working principle of computer?​

Answers

Answer:

input, process, output, storage

___ testing may begin before the program is 100% complete in order to test particular sections of code in a reply to discreet functions or modules

A. Dynamic.

B. Static.

C. Visual.

D. Gray-box.

Answers

Gray-box testing may begin before the program is 100% complete in order to test particular sections of code in a reply to discreet functions or modules. Hence option d is correct.

What is the testing

Gray-box experiment is a type of operating system experiment where the exploratory has prejudiced information of the within operation of the system being proven.

It connects ingredients of two together vital and static experiment approaches. In silver-box experiment, the exploratory has approach to some news about the within form or law of the spreadsheet but does not have full information or perceptibility into the exercise analyses.

Read more about Gray-box. testing here:

https://brainly.com/question/29590079

#SPJ1

1byte= ________ bits
1 nibble= __________ bits
1 MB= _________ bits
1PB= ____________ TB
1 ZB= ___________ EB

Answers

Explanation:

1 byte=8bits

1 nibble = 4bits

1MB= 8000000bits

1PB= 1000TB

1ZB= 1000000000000EB

Suppose you have a byte-addressable virtual address memory system with eight virtual pages of 64 bytes each, and four page frames. Assuming the following page table, answer the questions below:
Page Frame Valid BIT
0 1 1
1 3 0
2 - 0
3 0 1
4 2 1
5 - 0
6 - 0
7 - 0
How many bits are in a virtual address?

Answers

A byte-addressable virtual address memory system with eight virtual pages of 64 bytes each has a virtual address size of 6 bits.

In the provided memory system, the virtual address consists of two components: the virtual page number and the offset within the page.

Given that there are eight virtual pages, we require three bits to represent the virtual page number (\(2^3\) = 8). This means that three bits are needed to identify a specific virtual page.

Since each page has 64 bytes, we need six bits to represent the offset within each page (\(2^6\) = 64). The offset allows us to address individual bytes within a page.

Therefore, the virtual address in this memory system has a total of nine bits: three bits for the virtual page number and six bits for the offset.

Learn more about virtual address

brainly.com/question/31607332

#SPJ11

What does the program print out as a result of the given snippet of code?

supplies = ["pencil", "notebook", "backpack", "calculator", "pen"]
print(len(supplies))
5
8
[‘backpack’, ‘calculator’, ‘notebook’, ‘pen’, ‘pencil’]
[‘pencil’, ‘notebook’, ‘backpack’, ‘calculator’, ‘pen’]

Answers

Answer:

5

Explanation:

well the function len gives the length of the list

so the length of supplies is

5

Answer:

a

Explanation:

edge

help please!! worth 10 pts! answer quick please!

help please!! worth 10 pts! answer quick please!

Answers

Answer:

it has helped the people of today by

1.helped the young generation with there homework

2.you can book an hotel through the internet

3.you can also book a plane ticket via the internet

4.it is easier to look to ur email message via the internet

Can Anybody Answer This For Me ?

Can Anybody Answer This For Me ?

Answers

Answer:

I'm pretty sure its 3 only (c) III only gimme brainliest

6. A small design agency you are consulting for will be creating client websites and wants to purchase a web server so they can host the sites themselves. How will you advise them on this purchase?

Answers

Answer:

Explanation:

The best way to advise the agency in this matter would be to help them completely understand the total cost of ownership of the server. This includes the server itself but many other factors as well. Such as any and all server software and application software that they will need, an IT server manager, facility costs, security costs, backup features. These are some of the main costs that they will be incurring but there may be more unforeseen costs. Therefore the best way to advise them is by providing all of this information so that they can make the most informed decision possible.

2) State True or False. 1. Abacus is an electronic device. 2. ROM is read and writes memory of computer. 3. Header and footer appear at the top and bottom of 4. The first microprocessor is INTEL 4004. 5. CTRL + A is used to print data in M.S. word. Answer the following questions:​

Answers

Answer:

1 false

2 false

3 false

4  true

5 false

Explanation:

Answer:

False, True, True, True, False

Explanation:

1. False, it is a calculation device not electronic device.

2. True

3. True, Header appear at the top and Footer appear at the bottom.

4. True

5. False, Ctrl + A in MS Word or other text platforms is used to select all the text, not to print data in MS Word. To print data in MS Word or other text platforms we use Ctrl + P.

How did tribes profit most from cattle drives that passed through their land?
A.
by successfully collecting taxes from every drover who used their lands
B.
by buying cattle from ranchers to keep for themselves
C.
by selling cattle that would be taken to Texas ranches
D.
by leasing grazing land to ranchers and drovers from Texas

Answers

The way that the tribes profit most from cattle drives that passed through their land is option D. By leasing grazing land to ranchers and drovers from Texas.

How did Native Americans gain from the long cattle drives?

When Oklahoma became a state in 1907, the reservation system there was essentially abolished. In Indian Territory, cattle were and are the dominant economic driver.

Tolls on moving livestock, exporting their own animals, and leasing their territory for grazing were all sources of income for the tribes.

There were several cattle drives between 1867 and 1893. Cattle drives were conducted to supply the demand for beef in the east and to provide the cattlemen with a means of livelihood after the Civil War when the great cities in the northeast lacked livestock.

Lastly, Abolishing Cattle Drives: Soon after the Civil War, it began, and after the railroads reached Texas, it came to an end.

Learn more about cattle drives from

https://brainly.com/question/16118067
#SPJ1

There are many options for using Python in the cloud. What should you check if you experience errors with standard syntax? Select an answer: the compression method the version of the Python kernel being used the fonts and color schemes for the editor the version of the exercise files

Answers

If you encounter errors with standard syntax while using Python in the cloud, it is recommended to check the version of the Python kernel being used as it could be incompatible with the version of the programming language you're using.

If you experience errors with standard syntax while using Python in the cloud, you should check the version of the Python kernel being used.

Python is a popular high-level programming language for general-purpose programming. It's utilized in web development, data analysis, artificial intelligence, scientific computing, and other fields. Python is open-source software, which means it's free to use and distribute.

Cloud computing is a model for delivering services on-demand over the internet, like servers, storage, databases, networking, software, analytics, and intelligence, rather than using your local server or computer. The pay-as-you-go service is accessible from any location with an internet connection.

There are various options for using Python in the cloud. Let's have a look at some of the most common ones:

Web Services: It's a collection of remote computing services provided. It provides cloud computing services that can help you get your project up and running quickly.Azure: It's a cloud computing service created by that is frequently used for building, testing, deploying, and managing applications and services through a network of managed data centers.Cloud Platform: It's a collection of cloud computing services provided. It provides cloud computing services that can help you get your project up and running quickly.OpenShift: OpenShift is a container application platform for deploying and managing cloud-native applications that allows you to deploy and scale your Python applications in the cloud.

If you experience errors with standard syntax while using Python in the cloud, you should check the version of the Python kernel being used. This may occur if the kernel version used is incompatible with the version of the programming language you're using.

Learn more about standard syntax: brainly.com/question/20935990

#SPJ11

What is the error if I want to assign a value to that same index? i.e. var_str[5] = “r”

PLEASE QUICK

Answers

The program would not generate an error if the var_str list have up to 5 elements

How to determine the error?

The operation is given as:

Assign a value to that same index

This is represented as:

var_str[5] = "r"

The representations from the above code segment are

List = var_strIndex = 5Value = "r"

When a value is assigned to an index, the value at the index is updated to the new value, provided that the index exists in the list.

This means that the program would not generate an error if the var_str list have up to 5 elements

Read more about list at:

https://brainly.com/question/27094056

#SPJ1

45 points

Multiple Choice: Choose the answer that best fits each statement below.

______ 5. Which of the following can be found by clicking the AutoSum drop‐down?
a. Average
b. Min
c. Sum
d. All of the above

______ 6. Which option is used to prevent a cell reference from changing when a formula is copied to
another location?
a. Named ranges
b. Absolute cell reference

______ 7. An advantage to defining range names is:
a. Selections can be larger
b. Selections can be any format
c. Name ranges are easy to remember
d. Name ranges clear cell contents

True/False: Answer True or False for each statement below.
______ 8. You can only increase or decrease the decimal places by two.
______ 9. The comma style allows you to format with a thousands separator.
______ 10. Excel does not allow you to copy and paste formulas with AutoFill.

Answers

Answer:

5 its either a or b and 6 is b 7 is d  and 8 t 9 f 10 f

Explanat ion:

Find the quotient. 2.5 ÷ 5

Answers

Answer:

.5

Explanation:

you just divide 2.5 by 5

2.5 divided by 5 = 0.5

Write a program in java to input N numbers from the user in a Single Dimensional Array .Now, display only those numbers that are palindrome

Answers

Using the knowledge of computational language in JAVA it is possible to write a code that  input N numbers from the user in a Single Dimensional Array .

Writting the code:

class GFG {

   // Function to reverse a number n

   static int reverse(int n)

   {

       int d = 0, s = 0;

       while (n > 0) {

           d = n % 10;

           s = s * 10 + d;

           n = n / 10;

       }

       return s;

   }

   // Function to check if a number n is

   // palindrome

   static boolean isPalin(int n)

   {

       // If n is equal to the reverse of n

       // it is a palindrome

       return n == reverse(n);

   }

   // Function to calculate sum of all array

   // elements which are palindrome

   static int sumOfArray(int[] arr, int n)

   {

       int s = 0;

       for (int i = 0; i < n; i++) {

           if ((arr[i] > 10) && isPalin(arr[i])) {

               // summation of all palindrome numbers

               // present in array

               s += arr[i];

           }

       }

       return s;

   }

   // Driver Code

   public static void main(String[] args)

   {

       int n = 6;

       int[] arr = { 12, 313, 11, 44, 9, 1 };

       System.out.println(sumOfArray(arr, n));

   }

}

See more about JAVA at brainly.com/question/12975450

#SPJ1

Write a program in java to input N numbers from the user in a Single Dimensional Array .Now, display

Which jobs are most likely to be replaced by robots and what effect will this have

Answers

Answer:

Here we go. Generally the robots are designed in order to do the work which has very much risk and Humans find it too laborious or hard to do. The robots will be used for the army, or as laborers. In my country Nepal, there's a restaurant where robots are used as waiters. They take order from you and provide you the food. The robots can be used for various purposes but I don't think they will be appointed for the job of higher authority. The use of robots will have massive effect in human life. The use of robots and appointing them in various jobs will cause the problem of unemployment. The poor will be affected and their existence may get into problem. This is one effect but there can be many effects from the use of robots. Using robot in army can reduce human deaths but also people get unemployed. There is both advantage and disadvantage from their use.

which of the following is not a part of a database? group of answer choices a. worksheets b. tables c. fields d. records

Answers

Worksheets are not part of a database.

A database typically consists of tables, which are made up of fields (columns) and records (rows). Worksheets are a

feature of spreadsheet software like Microsoft Excel, which can be used for data analysis but is not typically

considered a part of a database.  These worksheets are objects a member of the Worksheets collection. The

The worksheets collection contains all the Worksheet objects in a workbook.

The Worksheet object is also a member of the Sheets collection. The Sheets collection contains all the sheets in the workbook (both chart sheets and worksheets).

learn more about the database:https://brainly.com/question/518894

#SPJ11

whats the meaning of Daisy Chaining vs Double drops

Answers

Daisy chaining and double drops are both terms used in the context of computer networking.

Daisy chaining refers to the practice of connecting multiple devices in a series, where each device is connected to the previous one, forming a chain. In this setup, the last device in the chain is connected to the main network or computer.

Double drops, on the other hand, refer to a configuration where two devices are connected directly to a network switch or hub using separate cables. This setup is often used to improve network performance by providing two separate data pathways for devices to communicate with the network.

In summary, daisy chaining involves connecting devices in a series, while double drops involve connecting two devices directly to a network switch or hub.

To know more about computer network visit:

brainly.com/question/13992507

#SPJ11

The first commercially available digital camera was which of the following?

Answers

Kodak Professional Digital Camera System

hope it helps

pls mark me as brainliest

Answer:

D

Explanation:

None of the above

what version of vsftpd contained the smiley face backdoor?

Answers

Answer:

Chris Evans, author of vsftpd announced that the master site for vsftpd was compromised and that the latest version of vsftpd (vsftpd-2.3.4.tar.gz) was backdoored. The backdoor payload is interesting. In response to a smiley face in the FTP username, a TCP callback shell is attempted. There is no obfuscation.

Explanation:

The master site for vsftpd was compromised, and the most recent version of vsftpd has a backdoor, according to vsftpd programmer Chris Evans. The payload on the backdoor is intriguing. A TCP callback shell is tried in response to a smiley in the FTP username. There is no concealment.

What version of vsftpd had smiley face backdoor?

Vsftpd version 2.3. 4 that could be downloaded from the main site was found to have been compromised in July 2011. A ":)" smileyface can be used as the username when entering into a compromised vsftpd-2.3. 4 server, giving users access to a command shell on port 6200.

The idea behind the attack against VSFTPD 2.3. 4 is to send a specific sequence of bytes on port 21 to start the malicious vsf sysutil extra() function, which, if executed successfully, opens the system's backdoor on port 6200.

causes the backdoor to be opened, which causes a shell to start listening on TCP port 6200. After a client connects to it and disconnects from it, the shell stops listening. This might be used by a remote, unauthenticated attacker to execute arbitrary code as root.

Thus, The master site for vsftpd was compromised, and the most recent version of vsftpd has a backdoor.

For more information about vsftpd had smiley face backdoor, click here:

https://brainly.com/question/535743

#SPJ6

Which type of storage disk and disk drive can you use in the given situation?

Amy wants to borrow an interesting movie from Bruce so that she can watch it in her leisure time. Amy can hand over a (BLANK) to Bruce to copy 900 MB file. Bruce needs to have a (BLANK) drive to record data on the used DVD.


BLANK 1

CD
hard disk
DVD

BLANK 2

DVD-RR
DVD-recordable
DVD-RW​

Answers

I : DVD

II:DVD-R

A DVD-RW would work too.

The types of storage disk drives that can use in the given situation are as follows:

Amy can hand over a DVD to Bruce to copy a 900 MB file. Bruce needs to have a DVD-RW drive to record data on the used DVD.

What do you mean by Storage disk?

Storage disk may be defined as a type of hardware device that can be used to store and save digital data and applications which may be in the form of images, video, audio, etc. For example, CDs, DVDs, hard disks, pen drives, etc.

Hard disks generally store a large quantity of data like 120GB to 30.72 TB. But here the data required to be stored is only 900 Mb, so DVD is the most accurate choice for this storage. It stores 500Mb of data to 8.5 Gb. A single-layer HD-DVD stores up to 15GB of storage capacity.

Therefore, Amy can hand over a DVD to Bruce to copy a 900 MB file. Bruce needs to have a DVD-RW drive to record data on the used DVD.

To learn more about Storage Disk, refer to the link:

https://brainly.com/question/14762201

#SPJ2

Given a sorted list of integers, output the middle integer. a negative number indicates the end of the input (the negative number is not a part of the sorted list). assume the number of integers is always odd.
ex: if the input is: 2 3 4 8 11 -1
the output is:
middle item: 4
the maximum number of inputs for any test case should not exceed 9. if exceeded, output "too many numbers". hint: first read the data into a vector. then, based on the number of items, find the middle item. 276452.1593070
(must include vector library to use vectors)

Answers

inputs=[]

num_inputs=int(input())

if(num_inputs>9):

   print("Too many inputs")

else:

   print(num_inputs)

   for i in range(num_inputs):

       inputs.append(input())

   print(inputs)

   middle_position=int(num_inputs/2)

   print(inputs[middle_position])

I have a tech question. I'm not getting emails from someone. I still have a lot of storage on my account. I have tried swapping devices. I have tried logging out and logging back in. I'm not sure what to do.

Answers

Answer:

you have delete your old mails And check out your met connection and also check you didn't block him

When first designing an app, all of the folldwing are important EXCEPT
A. debugging
B. determining how a user would interact with the app.
C. determining the purpose of the app
D. identifying the target audience

Answers

Answer:

B

Explanation:

Determining how the user could interact with the app varies person to person, the others are essential to creating apps though.

Research various credit cards to find low APR's, transactions fees, annual fees, over limit fees. Report on the card you find

Answers

APR (Annual Percentage Rate): This is the interest rate you will be charged on your credit card balance if you carry it over from month to month. The lower the APR, the less you will pay in interest over time. It is impossible to obtain credit cards information.

What is the APR's and transactions fees about?

Transaction Fees: Some credit cards charge fees for certain types of transactions, such as cash advances or foreign transactions. These fees can add up quickly, so it's important to find a card with low or no transaction fees.

Annual Fees: Some credit cards charge an annual fee for the privilege of using the card. While some premium cards may have high annual fees, there are many credit cards available with no annual fee.

Over Limit Fees: Some credit cards charge a fee if you go over your credit limit. This fee can be significant, so it's important to find a card that doesn't have this fee or that has a high credit limit.

Therefore, It's important to note that there are many different credit cards available, with a wide range of fees and features. It's a good idea to research several different cards to find the one that best suits your needs. It's also good to check the credit card's website for any fees and offers that are not mentioned in the advertisement.

Learn more about APR's from

https://brainly.com/question/1686286

#SPJ1

1) What is CPU ? Explain it's parts.
2) what is memory ?
3) What is Primary memory ? Explain RAM and ROM.
4)What is secondary memory ? Explain it's types.
5) What is output Unit Explain soft copy Output and Hard copy output.​

Answers

Answer:

Brother search these questions individually in gle and you will find all there, better than waiting for answers here.

Explanation:

Have a nice day :)

Answer:

Ans.1 -The CPU is also known as central processing unit is the processor or brain of the computer. Ans.2-Storage device of a computer is called computer memory. Ans.3-Primary memory consists of RAM(Random access memory) and (Read only memory). Ans.4-Secondary memory is permanent and so is called non-volatile memory. Ans.-5 I don't know

a network command-line utility in ms windows that tracks and displays the route taken by ipv4 packets on their way to another host is called:

Answers

This tool is useful for diagnosing network issues and determining the path data takes between two devices.

Explain  diagnosing network?

Your question is: a network command-line utility in MS Windows that tracks and displays the route taken by IPv4 packets on their way to another host is called what?

Your answer: The network command-line utility in MS Windows that tracks and displays the route taken by IPv4 packets on their way to another host is called "tracert" or "trace route." This tool is useful for diagnosing network issues and determining the path data takes between two devices.

Learn more about diagnosing network

brainly.com/question/29353061

#SPJ11

what information about a cisco router can be verified using the show version command?

Answers

- the routing protocol version that is enabled.
- the value of the configuration register.
- the operational status of serial interfaces.
- the administrative distance used to reach networks.

develop a program implementing a REST API client that will provide the end-user with the functionality to inquire about real-time flights prices. This also can be a command line or a user interface although a CLI interface will gain more points.

Answers

Developing a program implementing a REST API client for real-time flight price inquiries, with a CLI interface, is an efficient way to provide end-users with the desired functionality.

To implement a REST API client for real-time flight price inquiries, we can utilize a programming language like Python and libraries such as Requests or HTTP client libraries specific to the chosen programming language. The program will interact with the REST API by sending HTTP requests and handling the responses.

First, we need to define the endpoints and methods provided by the flight price API. This includes the endpoint for flight price inquiries and the required parameters or headers for authentication, location, dates, and other relevant information.

Next, we can design the CLI interface to allow the end-user to input their flight details, such as departure and arrival locations, dates, and any other required information. The program will then construct the appropriate API request using the user's input, send the request to the API endpoint, and retrieve the response.

The response from the API can be parsed and displayed to the user in a user-friendly format, providing real-time flight prices and any additional relevant information such as airlines, flight duration, and available seats.

By implementing a CLI interface, users can easily interact with the program by entering commands or inputting data, making it a straightforward and efficient way to inquire about real-time flight prices.

Learn more about Program

brainly.com/question/14368396

#SPJ11

Other Questions
please help me!!!!!! all of the following may be benefits of a technical or vocational college except HELPPP ME PLEASE ITS A VERY IMPORTANT TESTTTTT The interval of time between when a vector takes an infectious meal, and when it begins to transmit the pathogen, is referred to as the: (a) vectorial capacity; (b) intrinsic incubation period; (c) vectorial competence; (d) extrinsic incubation period. write a statement that declares an array of char named streetaddress that contains exactly eighty elements. Sudoku Company issues 26,000 shares of $8 par value common stock in exchange for land and a building. The land is valued at $235,000 and the building at $380,000. Prepare the journal entry to record issuance of the stock in exchange for the land and building. Which of the following statements best describes the solution of this inequality? x < 9 A;There is no solution.B:There is exactly one solutionC: There are exactly eight solutions.D:There are infinitely many solutions. help me please :)))))))) solve the following system6x-3y=15x+3y=-8 A claim should not be specific because you need to be able to prove your argumentA. TrueB. False What should parents' and children be taught to prevent the spread of infection to the immediate family An isosceles triangle includes two 72angles. Which equation could be used tofind the measure of the third angle?A X + 72 = 180B X = 180 - 72C 72-X= 180D 180 - 2(72) = X 1. Marlin averages for his Social Studies class is listed below. If the teacherweights homework at 20%, quizzes at 20%, tests at 45%, and the final examat 15%, what is Marlin's class average?1)61%2)71%3)74%4)82% each data type is a class from which a variable can be ____. Awarding 15 points for best answer! Graph these equations:xy=-1y=x2 4Which symbol makes this statement true?18 - 3 x 6 4 = 4A XBC+ 1D + 1. Who is considered to be the father of Athenian democracy?A. DracoB. SolonC. PericlesD. Cleisthenes The Schwarzschild radius of a black hole depends on ________. both the mass and chemical composition of the black hole the observationally measured radius of the black hole only the mass of the black hole the way in which the black hole formed What is 11/12 divided by 1/3 Only these people are allowed to attend Sprint Retrospectivea. Scrum master and Development teamb. Product owner and Development teamc. Scrum master and Product ownerd. Scrum Team