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
Lerok [7]
3 years ago
15

Can you right the C++ of this algorithm? Inizio = Start, Fine= End. THANK YOU SO MUCH!!

Computers and Technology
1 answer:
posledela3 years ago
4 0
<span>#include <iostream> using namespace std; bool bears(int n); int main(){ int number; do{ cout<<"enter the amount of bears (press 0 to stop the program): "; cin>>number; if (bears(number)){ cout<<"you have reached the goal!"<<endl; } else{ cout<<"sorry, you have not reached the goal."<<endl; } }while(number != 0); } bool bears(int n){ if (n < 42){ return false; } else if (n == 42){ return true; } else{ if (n % 5 == 0){ return bears(n - 42); } else if(n % 2 == 0){ return bears(n / 2); } else if(n % 4 == 0|| n % 3 == 0) { int one; int two; one=n%10; two=(n%100)/10; return bears(n - one * two); } } <span>}</span></span>
You might be interested in
What are two benefits of consumer programs
Tcecarenko [31]

They help consumers identify the best product reviews from various sources.

They help prosecute companies that sell unsafe products to consumers.

5 0
3 years ago
8. Given the array String[] words, which already contains 1 or more values, write a block of code which counts and returns the n
Vikentia [17]

Answer:

Following are the code to this question:

public class Main//defining a class

{

public static void main(String[] arg)//defining main method

{

  String[] words={"Key","day", "Know", "kind"};//defining array of String words

  int x=0;//defining integer variable for count value

  for(int i=0;i<words.length;i++)//defining for loop for count value

  {

 if(words[i].startsWith("k")||words[i].startsWith("K"))//use if block to check word start from k

  x=x+1;//increment the value of x

  }

System.out.print("The number of letters which starts from k is: "+ x);//print value with message

}

}

Output:

The number of letters which starts from k is: 3

Explanation:

In this code, inside the main method an array of String "words" is defined that hold a value, and in the next step an integer variable "x" is defined, which is used to count the letters, which starts from k.

For this, a for loop is used that counts the value and in this an, if block is defined that uses the "startsWith" method to check the value and increment the value of x and at the last, it prints its value.

7 0
2 years ago
What are some ways in which reading and writing have changed in our newly networked world
olga_2 [115]
Reading and writing have given us both a way to pass on knowledge and learn things we cant learn first hand.<span />
3 0
3 years ago
In contrast to data in a database, data in a data warehouse is described as subject oriented, which means that it _____.
jonny [76]

Answer:

focuses on a certain subject

Explanation:

it means that it focuses on that one subject and none others

Hope it helps c:

6 0
2 years ago
Zadanie nr 1
Gennadij [26K]

Answer:

Explanation:

Rezonans, Obiekt bez wibracji ma tendencję do robienia tego z określoną częstotliwością zwaną naturalną lub rezonansową częstotliwością obiektu. (Ta częstotliwość zależy od wielkości, kształtu i składu przedmiotu). Taki przedmiot będzie silnie wibrował, gdy zostanie poddany wibracjom lub regularnym impulsom o częstotliwości równej lub bardzo zbliżonej do swojej częstotliwości naturalnej. Zjawisko to nazywa się rezonansem. Dzięki rezonansowi stosunkowo słaba wibracja w jednym obiekcie może powodować silne wibracje w innym. Analogicznie termin rezonans jest również używany do opisania zjawiska, w którym oscylujący prąd elektryczny jest wzmacniany sygnałem elektrycznym o określonej częstotliwości.

Przykład rezonansu zapewnia silnik, który powoduje wibracje mebla w innej części tego samego domu. Drgania te występują, ponieważ częstotliwość naturalna mebli jest równa częstotliwości drgań ustawianych przez silnik. Mówi się, że meble rezonują z silnikiem. Rezonans można również zaobserwować w samochodzie, gdy pewna popielniczka Partan, na przykład wibruje, gdy samochód jedzie z określoną prędkością. Popielniczka rezonuje z wibracjami silnika przy tej prędkości.

Rezonans mechaniczny może wytwarzać wibracje wystarczająco silne, aby zniszczyć obiekt, w którym występują. Na przykład żołnierze maszerujący nad mostem mogą wytwarzać ekstremalne wibracje z częstotliwością naturalną mostu i roztrzaskiwać go na części. Z tego powodu żołnierze przebijają się, by przejść przez most. W 1940 r. Podmuchy wiatru w Puget Sound Narrows w Tacoma w stanie Waszyngton spowodowały, że most wiszący wibruje z naturalną częstotliwością i most zawalił się.

W muzyce rezonans służy do zwiększenia intensywności (głośności) dźwięku. Na przykład stosunkowo słabe wibracje wytwarzane na końcu rurki organowej powodują, że kolumna powietrza w rurze wibruje w rezonansie, znacznie zwiększając głośność dźwięku. Zasada ta dotyczy także głosu ludzkiego, w którym wibracje strun głosowych są wzmacniane przez wibracje rezonansowe w kanałach ustnych i nosowych.

Rezonans elektryczny służy do strojenia radiotelefonów i telewizorów. Strojenie polega na ustanowieniu obwodu o częstotliwości rezonansowej równej przydzielonej częstotliwości żądanej stacji.

6 0
3 years ago
Other questions:
  • 1.Write the Qbasic program to find sum of any 10 different numbers.
    12·1 answer
  • You are responsible for performing all routine maintenance on your company's laser printers. Which of the following maintenance
    15·1 answer
  • Regulatory and informational markers are easily identified through which features
    12·1 answer
  • Which of the following would most likely be responsible for configuring firewalls and IDPSs, implementing security software, and
    8·2 answers
  • You are contacted by a project organizer for a university computer science fair. The project organizer asks you to hold a forum
    10·1 answer
  • For the following C code assume k and m are passed in x3 and x4 respectively, while result is returned in x4. Compile this code
    14·1 answer
  • Raul needs to ensure that when users enter an order into the tblOrders, the shipping date is at least two days after
    9·2 answers
  • Who is the father of computer?​
    14·1 answer
  • What underlying concept is edge computing based on?
    13·2 answers
  • What kind of AR target category makes sense for a playing card with a picture on it?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!