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]
1 year 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]1 year 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
Application software solve application programs true or false​
asambeis [7]

Answer: False

Explanation: Application software, on the other hand, refers to software that is designed to perform a certain task. It's just a collection of programs that customers can use.

8 0
2 years ago
_____ are like selection lists in which they limit fields to a set of possible values; but, unlike selection lists, the options
natali 33 [55]

Radio buttons exist like selection lists in which they limit fields to a set of potential values; but, unlike selection lists, the options appear as respective controls in the web form.

<h3>What is Radio button?</h3>

A radio button or option button exists as a graphical control element that permits the user to select only one of a predefined set of mutually exclusive options. The singular property of a radio button causes it distinct from checkboxes, where the user can select and unselect any numeral of items.

Radio buttons exist as a common way to permit users to make a single selection from a list of options. Since only one radio button can be selected at a period (within the same group), each available option must be its item and label. Radio buttons exist like selection lists in which they limit fields to a set of potential values; but, unlike selection lists, the options appear as respective controls in the web form.

To learn more about Radio button refer to:

brainly.com/question/20476366

#SPJ4

8 0
1 year ago
What does manual exposure mean
Julli [10]
Amount of light per unit area
6 0
2 years ago
Read 2 more answers
The physical view of a database system refers to
tigry1 [53]

Answer:

C. how and where the data are physically arranged and stored.

Explanation:

The physical view as the name implies describes how and where the data are physically arranged in the database. This deals with the physical arrangement of data in the database. This user usually view the database in a logical way. e.g table. The physical arrangement is usually used by database specialists. There can be multiple logical view of a database but just a single view of the physical view.

8 0
3 years ago
Privacy,security and ethicalissues related to social networking
Harlamova29_29 [7]

Answer:

SUre

Explanation:

7 0
3 years ago
Other questions:
  • . Electricians will sometimes call ______ "disconnects" or a "disconnecting means."
    12·1 answer
  • Davia draws a shape with 5 sides. two sides are each 5 inches long. two other sides are each 4 inches long. the perimeter of the
    15·1 answer
  • What is one advantage of top-down programming design?
    13·2 answers
  • Generate an array x that has n=100 random numbers that are uniformly distributed over the interval [0,1) . Look up how to use th
    8·1 answer
  • A SOCCER club uses ICT to
    10·1 answer
  • Imagine that you were hired to create the label for a new brand of soup. The client wants to emphasize that the soup has homemad
    10·1 answer
  • Why does computer uses 0s and 1s to procress data​
    7·2 answers
  • mary has access to certain resources because she is in the Research division of her company. She has access to other resources b
    15·1 answer
  • Directions: Give the shortcut key for the following commands: 1. Open 2. Save 3. New document 4. Copy 5. Undo 6. Redo 7. Paste 8
    5·1 answer
  • What year was internet inverted
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!