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
Hypertext Markup language (HTML) version _____ added support for style sheets to give web designers greater control over page la
Ipatiy [6.2K]

Answer:

4.01 version .

Explanation:

A hypertext Markup language is used for designing the web page when we added the CSS on the web page we can create the web page more efficient manner and also there is more control over the web page because we can easily call the classes of CSS.

The Hypertext Markup language version 4.01 provides greater flexibility on the web page also We can also control the page layout in a very easy manner. The appearance of the web page is good as compared to version HTML 4

8 0
3 years ago
Iglesias intends to use a word processing program to create a web page. Which of these options should Iglesias use?
Murrr4er [49]
He should view the Outline THEN the Layout and finally preview in web browser.
6 0
3 years ago
John travels a lot and he needs to access his documents and services on the go. Which of these technologies allows his to access
kirza4 [7]

<u>Answer:</u>

<u>Cloud computing</u><em> allow the user to access software or any document from the remote place.</em>

<u>Explanation:</u>

Let us understand what does the word cloud actually means. In simple terms, we get rain from cloud, but we don’t know actually which cloud burst to give rain.

In a similar way, <em>the cloud computing is the concept of storing files in multiple servers and multiple location</em> and it provide access when the <em>client needs the source. </em>

Cloud computing enable user to work on <em>software online</em> or to download document or <em>edit / create documents online</em>. Certain services are <em>free and few other are paid.</em>

6 0
3 years ago
Why is it worth remembering “All people seem to need data processing”?
Rzqust [24]
The answer is .........C
3 0
3 years ago
Read 2 more answers
Which invention provided instant communication and information to a massive audience for the first time?
igor_vitrenko [27]
B. Television. It provided <span>instant communication and information to a massive audience for the first time in 1927.

Hope this helps :)</span>
4 0
2 years ago
Read 2 more answers
Other questions:
  • Savings accounts typically offer more interest than what
    10·1 answer
  • Name the component used in first generation of computer​
    10·1 answer
  • ____________________ is the premeditated, politically motivated attacks against information, computer systems, computer programs
    6·2 answers
  • Write a program that prints all the numbers from 0 to 6 except 3 and 6. Expected output: 0 1 2 4 5
    13·1 answer
  • What is hydraulic fracturing?
    7·1 answer
  • You can't get close enough to the facility interior to launch an evil twin attack against its wireless clients; in fact, you hav
    11·1 answer
  • Trong ửod muốn trình bày dạng cột càn thực hiện lệnh nào
    13·1 answer
  • How do you copy a file​
    9·1 answer
  • ____ is an example of a set of prewritten classes that allows you to access data stored in a database.
    8·1 answer
  • Try using the index method yourself now! Using the index method, find out the position of "x" in "supercalifragilisticexpialidoc
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!