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
satela [25.4K]
2 years ago
8

LAB: Phone number breakdown Given a long long integer representing a 10-digit phone number, output the area code, prefix, and li

ne number using the format (800) 555- 1212 Ex: If the input is: 8005551212 the output is: (800) 555-1212 Hint: 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. 34/202.2014 LAB ACTIVITY 2.30.1: LAB: Phone number breakdown 0 / 10 main.c Load default template... 1 #include 2 3 int main(void) 4 5 5 long long phoneNumber; 6 long long prefix; ? long long areaNum, lineNum; scanf("%11d", &phoneNumber); printf("%d11", phoneNumber); 9 10 11 12 + 13 14 15 16 17 18 areaNum = phoneNumber/10000000; prefix = (phoneNumber/10000)%10000; lineNum = phoneNumber % 10000 printf("llf-llf-11f\n", areaNum, prefix, lineNum); return;
Computers and Technology
1 answer:
SSSSS [86.1K]2 years ago
8 0

The program illustrates the use of modulo operator.

The modulo operator (%) returns the remainder of a division.

<u>Take for instance: </u>

<em>The result of 4 % 3 is 1, because when 4 is divided by 3, the remainder is 1</em>

So, the program in C is as follows, where comments are used to explain each line

#include <stdio.h>

int main(){

   //This declares all variables as integer

   long phoneNumber, prefix,areaNum, lineNum;

   //This gets input for phoneNumber

   scanf("%ld", &phoneNumber);

   //This prints the  input for phoneNumber

   printf("%ld", phoneNumber);

   

   //This calculates the area code

   areaNum = phoneNumber/10000000;

   //This calculates the prefix

   prefix = (phoneNumber/10000)%1000;

   //This calculates the line numbers

   lineNum = phoneNumber%10000;

   

#This prints the required area code

   printf("\n(%ld)%ld-%ld\n", areaNum, prefix, lineNum);

   return 0;

   

}

At the end of the program, the phone number breakdown is printed

See attachment for sample run

Read more about C programs at:

brainly.com/question/13219435

You might be interested in
As you are researching RAM for a computer you are building that will be used as a home office server for his small business. The
Allushta [10]

Answer:

You would probably want ram with a good amount of gigabytes. This will allow the computer to run more things at a time without crashing. A best answer will be appreciated

7 0
3 years ago
Read 2 more answers
What is Human Dignity
jeyben [28]

Answer:

what is human dignity

Explanation:

The English word dignity comes from the Latin word, dignitas, which means “worthiness.” Dignity implies that each person is worthy of honor and respect for who they are, not just for what they can do. ... In other words, human dignity cannot be earned and cannot be taken away.

6 0
3 years ago
An advertiser who sells coffee beans adds the keyword “Java'” to an ad group. After two weeks, she runs a placement performance
FrozenT [24]

Answer: (D) Exclude “Programming” as a topic

Explanation:

So when programming is excluded as a topic then whenever one searches for that  coffee beans then it will not show up on websites related to programming. In this way it restricts the web server to host ads in irrelevant sites.

4 0
4 years ago
Peripherals can be used to input information. True False
MariettaO [177]

True, cause its actual job is to either be used as an input or output device in various ways but I hope this helps ma friend :)


6 0
3 years ago
Read 2 more answers
Jeremy is designing a website for a florist. He intends to discuss the web design with his client. Which tool should Jeremy use
stiv31 [10]

Answer:

C.  layout of each page with its respective elements

Explanation:

A layout  of each page with its respective elements will give the client a good idea of the final product and help him confirm his desires/requests towards the creation of the Web site.  Most people are visual, especially about things they don't fully understand, so a clear and visual representation is best.

<u>A. Bulleted lists and titles</u>... won't give the idea of the full layout of the Web site.

<u>B. chart depicting</u>....  that's more a tool for the programmer than the client, although user flow is important, it isn't as much as the visual aspect of each page.

<u>D. pictures and screenshots of websites of other florists..</u>. That could be a useful aid on the first contact, but the question implied the Web site is already in progress... so that wouldn't help much.

<u>E.  programming code for the website</u>, absolutely not, the client hired Jeremy not to have to deal with that.

5 0
4 years ago
Other questions:
  • you want to discard your old computer ,want to securely erase that data from your hard drive. what can you use to do this and wh
    12·1 answer
  • How is a Personal Fact Sheet used? a. A Personal Fact Sheet is a tool used to market yourself and build your network b. A Person
    13·2 answers
  • What are the 21St century competencies or skills required in the information society?<br>​
    15·1 answer
  • To access WordPad, Jill will click on Start, All Programs, Accessories, and WordPad. To access Notepad, Karl will click on Start
    5·1 answer
  • The computer mouse is used to
    11·1 answer
  • What is hyper transport
    10·1 answer
  • Write a C++ program to find if a given array of integers is sorted in a descending order. The program should print "SORTED" if t
    14·1 answer
  • Give an essay on a way I can be a better person. If not correct I will refund. Best answer gets brainiest. Detailed, 5 sentience
    10·2 answers
  • A. Why are the data known as raw facts? Explain.​
    14·2 answers
  • Which is an example of a demand account
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!