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
Sedaia [141]
3 years ago
6

Write a bash script HW4p2.sh to print out the list of numbers between 0 to 100 (including 0 and 100) that are divisible by both

3 and 5. You must create a bash function inside the script to check the divisibility by 3 and 5.
Computers and Technology
1 answer:
ratelena [41]3 years ago
8 0

Answer:

#!/bin/bash

function number_div( ) {

   for i in {0. .100};

   do

   if (( $i % 3 == 0 ))

   then

   echo $i

   elif (( $i % 5 == 0 ))

   then

   echo $i

   else

   echo "Number not divisible by 3 and 5"

   fi;

   done

}

number_div( )

Explanation:

The bash script is saved as "HW4p2.sh" and executed as "./HW4p2.sh". This code would print all and only numbers divisible by 3 or 5.

You might be interested in
In the Scrum board, prioritizing the issue backlog is done in the ———- mode.
IrinaK [193]

Answer:

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

Explanation:

Scrum Board is a tool that is used by the scrum teams to view the product backlog. The Scrum task board makes the sprint backlog visible for the team.

In the Scrum board, prioritizing the issue backlog is done in the <u>Current View</u> mode.

However, it is noted that in Scrum board there are two view modes (Tree view mode and List view mode) for the issues in the backlog. The issues that are prioritized is listed in the current view mode.  

7 0
3 years ago
Which task is most suitable for creating an algorithm?
Anna71 [15]
A.
-HomeTaey
(ask anytime)
if I get it wrong, sorry
8 0
3 years ago
Read 2 more answers
Imagine that a crime has been committed and being a police officer you have to investigate the case. Solving a crime can be a ve
Igoryamba

Explanation:

On October 31, around twelve o'clock at night, the lights were dull. It was Siberian cold and I was walking painfully under the whitish lighting of a lamppost and the retro neon lights of a convenience store in a neighborhood that was buzzing when I went to buy meat. buildings, grayish in this half-light, crumbled under the weight of sleep, while the neighborhood was still open. Its decoration was particularly macabre in tone: synthetic but very sticky spider webs adorned the porches of the terraces, pumpkin ornaments are exhibited like works of art, ... Some pushed the macabre by hanging mannequins made up in corpses. At the entrance to the neighborhood, I found the body of its owner stabbed. Frozen in place, I wondered what else awaits me. My heart was pounding, feeling a shiver of anguish. When I was removing the phone from my pocket to call my police friends, my hands were clenched in fear. An investigation was carried out to find out the causes of death. Also, I went with them so they take my words. Hopefully the murderer will be arrested to put an end to this sybilinous crime.

4 0
3 years ago
Your friend is an intern at the local Department of Health and needs to prepare a report about the recent activity of the influe
Butoxors [25]

Answer:

#include<bits/stdc++.h>

using namespace std;

int main(){

  // Defining Variables

  int no_of_weeks;

  int total_cases = 0;

  //Declaring Vector of Pair of Integer and string

  std::vector<pair<int,string>> data;

  // Taking Input for the Number of Weeks

  cout<<"Enter No. of Weeks\n";

  cin >> no_of_weeks;

  // Running the Loop for no_of_weeks times

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

      int A,B,C;

      // Taking Input for different types of flus

      cout<<"Enter No. of Cases of Flu A, B, C for week" << i + 1 << " seperated by space : \n";

      cin >> A >> B >>C;

      // Adding all the cases in a week

      int cases_in_a_week = A + B + C;

      // Updating total cases

      total_cases += cases_in_a_week;

      // Declaring the level variable

      string level;

      // Updating the level of the week corresponding to each case

      if(cases_in_a_week < 500) level = "Low";

      else if(cases_in_a_week >= 500 && cases_in_a_week < 2000) level = "Moderate";

      else level = "Widespread";

      // Storing the Week's information by using a vector of pairs

      // in which pair's first is the number of cases which is of type int

      // while the second is the level of the flu which is of the type string

      data.push_back(make_pair(cases_in_a_week,level));

  }

  // Linking the stdoutput to the flu_report.txt file

  // this also creates the file with the same name if it doesn't exists

  freopen("flu_report.txt", "w", stdout);

  // Printing the respective output data with Bar Chart of stars for each level

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

      //printing the week no. and number of cases

      cout<<i+1<<" "<<data[i].first<<" "<<data[i].second<<" |";

      //calculating the number of stars

      int stars = data[i].first/250;

      //printing the stars of the bar chart

      for(int j = 0; j < stars ; j++) cout<<"*";

      cout<<endl;

  }

  //printing the total number of cases

  cout<<total_cases;

}

Explanation:

3 0
3 years ago
Read 2 more answers
A company was asked to develop a smartphone app to help people locate a car of their choice to purchase from a complex of more t
daser333 [38]

Answer:

the gps and a map

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • 1. An auto repair shop charges as follows. Inspecting the vehicle costs $75. If no work needs to be done,
    9·1 answer
  • What do computer viruses eat for snacks?
    7·2 answers
  • A field with the ____ data type can store a unique sequential number that Access assigns to a record. Access will increment the
    7·1 answer
  • Brad is joining a big website design firm. He is worried that he may not be able to adapt to the company culture. What can he do
    15·1 answer
  • Your friend gave you a flash drive containing photos from a weekend event. After you copy the files, you notice a bunch of .DS f
    6·1 answer
  • Match the items with their respective descriptions. organizes files make files easily searchable keeps track of file creation an
    14·1 answer
  • A section in a history book describing the conditions and causes of the Great Depression in the Midwest in the 1930s. a. Enterta
    15·1 answer
  • Which keyboard shortcut do we use to turn on APC?​
    13·1 answer
  • In Scheme, the form (symbol-length? 'James) will return: Group of answer choices 0 5 6 error message
    11·1 answer
  • Python 3.12 LAB: Input and formatted output: Right-facing arrow Given input characters for an arrowhead and arrow body, print a
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!