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
Elanso [62]
3 years ago
8

Use the modulo operator (%) to get the desired rightmost digits. Ex: The rightmost 2 digits of 572 is gotten by 572 % 100, which

is 72. Hint: Use / to shift right by the desired amount. Ex: Shifting 572 right by 2 digits is done by 572 / 100, which yields 5. (Recall integer division discards the fraction). For simplicity, assume any part starts with a non-zero digit. So 0119998888 is not allowed.
Computers and Technology
1 answer:
uranmaximum [27]3 years ago
5 0

Hi, you haven't provided the programing language in which you need the code, I'll just explain how to do it using Python, and you can apply a similar method for any programming language.

Answer:

def rightMost(num):

   lenNum = len(str(num))

   rightNum = num%(10**(lenNum-1))

   print(rightNum)

   return(rightNum)

Explanation:

In this function we receive an integer number, then we find how many digits this number has, and finally, we find the rightmost digits; the main operation is modulo (takes the remainder after a division), what we want is to take all the digits except the first one, for that reason we find the modulo of the number when divided by ten to the power of the length of the number minus one, for example, if the number is 2734 we divided by 10^(4-1), where four is the length of the number, this way we get 2734/1000 and the module of it is 734.

You might be interested in
What is the best scenerio for
Stels [109]

Answer:

the teacher said a (dash) reads pages on website pls answer me now i have to write it now

5 0
2 years ago
Read 2 more answers
Design and implement a class dayType that implements the day of the week in a program. The class dayType should store the day, s
Afina-wow [57]

The code is implemented based on the given operations.

Explanation:

#include <iostream>

#include <string>

using namespace std;

class dayType

{ private:

 string day[7];

 string presentDay;

 int numofDays;

public:

 void setDay(string freshDay);

 void printDay() const;

 int showDay(int &day);

 int nextDay(int day);

 int prevDay(int day) const;

 int calcDay(int day, int numofDays);    

 dayType()

 {

  day[0] = "Sunday";

  day[1] = "Monday";

  day[2] = "Tuesday";

  day[3] = "Wednesday";

  day[4] = "Thursday";

  day[5] = "Friday";

  day[6] = "Saturday";

  presentDay = day[0];

  numofDays = 0;

 };

 ~dayType();

};

#endif

#include "dayType.h"

void dayType::setDay(string freshDay)

{

  presentDay = freshDay;

}

void dayType::printDay()

{

  cout << "Day chosen is " << presentDay << endl;

}

int dayType::showDay(int& day)

{

  return day;

}

int dayType::nextDay(int day)

{

day = day++;

if (day > 6)

 day = day % 7;

switch (day)

{

case 0: cout << "The successive day is Sunday";

 break;

case 1: cout << "The successive day is Monday";

 break;

case 2: cout << "The successive day is Tuesday";

 break;

case 3: cout << "The successive day is Wednesday";

 break;

case 4: cout << "The successive day is Thursday";

 break;

case 5: cout << "The successive day is Friday";

 break;

case 6: cout << "The successive day is Saturday";

 break;

}

cout << endl;

return day;

}

 

int dayType::prevDay(int day)

{

day = day--;

switch (day)

{

case -1: cout << "The before day is Saturday.";

 break;

case 0: cout << "The before day is Saturday.";

 break;

case 1: cout << "The before day is Saturday.";

 break;

case 2: cout << "The before day is Saturday.";

 break;

case 3: cout << "The before day is Saturday.";

 break;

case 4: cout << "The before day is Saturday.";

 break;

case 5: cout << "The before day is Saturday.";

 break;

default: cout << "The before day is Saturday.";

}

cout << endl;

return day;

}

int dayType::calcDay(int addDays, int numofDays)

{

addDay = addDays + numofDays;

if (addDay > 6)

 addDay = addDay % 7;

switch(addDay)

{

case 0: cout << "The processed day is Sunday.";

 break;

case 1: cout << "The processedday is Monday.";

 break;

case 2: cout << "The processedday is Tuesday.";

 break;

case 3: cout << "The processedday is Wednesday.";

 break;

case 4: cout << "The processedday is Thursday.";

 break;

case 5: cout << "The processedday is Friday.";

 break;

case 6: cout << "The processedday is Saturday.";

 break;

default: cout << "Not valid choice.";

}

cout << endl;

return addDays;

}

4 0
2 years ago
:)
Vilka [71]

Answer:

A, system software

Explanation:

that is answer an interpreter is a type of system software

5 0
2 years ago
Why is binary code made up of a series of ones and zeros?
Nadusha1986 [10]

A binary code represents text, computer processor instructions, or any other data using a two-symbol system. The two-symbol system used is often the binary number system's 0 and 1. The binary code assigns a pattern of binary digits, also known as bits, to each character, instruction, etc.

8 0
3 years ago
What purpose would tracking changes be most useful for?
olya-2409 [2.1K]
So, you can be able to make a prediction and understand the cycle.
6 0
3 years ago
Other questions:
  • Which function can you use to abbreviate the lengthy expression, A1+A2+A3+A3...+A19+A20?  MAX COUNT SUM ROUND
    10·2 answers
  • What lie does E.D. tell to keep the musical from being canceled? There is a television crew coming to do a story on it. Jake wil
    6·1 answer
  • What is the purpose of filters in a data base
    11·1 answer
  • A local cinema allows customer to make a movie ticket reservation. A customer can be
    6·1 answer
  • A list of sources used for in-text citations that appears at the end of a document is called:
    10·1 answer
  • س2) اکتب خوارزميه لحل المعادلة الرياضيه الاتيه
    9·1 answer
  • The add_prices function returns the total price of all of the groceries in the dictionary. Fill in the blanks to complete this f
    15·1 answer
  • If you have questions about taxes, where can you go to get answers?
    14·1 answer
  • Released in 1976, the Apple I was Apple Computer's first product.<br><br> O True<br> O False
    6·1 answer
  • F
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!