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
Neko [114]
3 years ago
6

Please help me on this coding problem :)

Computers and Technology
1 answer:
Vesnalui [34]3 years ago
4 0

Answer:

a=4 , b=1

Explanation:

I'm not a computer science major at all but I think I can help you with this code.

Our program wants us to add 2 to a get new a value while also subtracting 1 from b value to obtain new b value. We we want to for for as long b is not 0 and a/b is nonnegative.

One round we get:

New a=0+2=2

New b=3-1=2

Let's see if we can go another round:

New a=2+2=4

New b=2-1=1

We can't go another round because b would be negative while a is positive which would make a/b negative. So our loop stops at this 2nd round.

a=4 , b=1

Other notes:

2nd choice makes no sense because a is always going to increase because of the addition on a and b was going to decrease because of the subtraction on it.

Third choice makes no sense because a/b doesn't even exist.

Fourth choice a/b is negative not nonnegative.

You might be interested in
The force of impact is____.
sattari [20]
A.the speed which can comer a curve
8 0
3 years ago
Read 2 more answers
HELP PL
Nikolay [14]
A. journals

Medical journals, or scientific journals are always a good source for information for something like this!
3 0
3 years ago
Read 2 more answers
Write a program that inputs two characters first and second, and then prints all non-alphabetic characters starting from second
baherus [9]

Answer:

fbtcft gdfgfffff tvfft gxf

8 0
3 years ago
Define the missing function. licenseNum is created as: (100000 * customID) + licenseYear. Sample output:
Juliette [100K]

Answer:

#include <iostream>

using namespace std;

class DogLicense{

   public:

       void SetYear(int yearRegistered);

       void CreateLicenseNum(int customID);

       int GetLicenseNum() const;

   private:

       int licenseYear;

       int licenseNum;

};

void DogLicense::SetYear(int yearRegistered) {

   licenseYear = yearRegistered;

}

void DogLicense::CreateLicenseNum(int customID) {

   licenseNum = (100000 * customID) + licenseYear;

}

int DogLicense::GetLicenseNum() const {

   return licenseNum;

}

int main() {

   DogLicense dog1;

   dog1.SetYear(2014);

   dog1.CreateLicenseNum(777);

   cout << "Dog license: " << dog1.GetLicenseNum() << endl;

return 0;

}

Explanation:

You can see the whole code above, but let me explain the fixed function.

void DogLicense::CreateLicenseNum(int customID) {

   licenseNum = (100000 * customID) + licenseYear;

}

The function header is already declared in the class. It takes <em>customID</em> as a parameter. To find out the <em>lisenseNum</em>, we need to apply the given formula <em><u>(100000 * customID) + licenseYear</u></em>.

6 0
4 years ago
Read 2 more answers
What type of system software manages memory?
Kobotan [32]

Answer:

"Operating System"

Explanation:

6 0
3 years ago
Other questions:
  • A(n) __________ is a recording of a motion picture, or television program for playing through a television.
    8·2 answers
  • Assume there is a variable, h that has already been assigned a positive integer value. Write the code necessary to compute the s
    9·1 answer
  • Where is a 3D modeler most likely to work?
    6·1 answer
  • Select each task that may be completed using a word processor.
    8·2 answers
  • IMPORTANT!!<br><br> How can you get real answer keys for edmentum (plato) courses as a student?
    11·1 answer
  • An IT suspects that an unauthorized device is connected to a wireless network. This is a result of pastry sharing on a device br
    13·1 answer
  • You do not have to move your fingers to click the top row reach keys.<br> 1. True <br> 2. False
    15·1 answer
  • Why is biodiversity so important to ecosystems?
    6·1 answer
  • Which wireless specification can connect to a school's WLAN and connect to multimedia display projectors wirelessly?
    7·1 answer
  • When you're writing for mobile devices, use ________ to present the most important information first and provide successive laye
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!