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
How does limiting a company's scope benefit the company? A. It encourages the company to use division of labor. B. It makes it e
Luda [366]

Answer

It makes it easier to produce a high quality product.

Explanation

Project scope is the part of project planning that involves determining and documenting a list of specific project goals, deliverable, tasks, costs and deadlines. in Project management it  involves the planning and organization of a company's resources to complete a specific task, event, or action and is usually a one-time event. It is an activity that is engaged in for the primary purpose of making a profit. These activities includes things like  production, operations, marketing, and administration

6 0
3 years ago
Read 2 more answers
For those that play pc games how do you go outside in The Sims 2?
yanalaym [24]

Answer:

My sister plays a lot of the sims 4 but I do recall she also played the Sims 2 so when she would go outside she would command them to do that.

Explanation:

If this does not work I would suggest you get a video that can explain it better than I possibly would? Considering the Sims 2 was made a while back you would maybe want somebody with a little more experience.

5 0
3 years ago
Read 2 more answers
Can someone help: how to get binary?
xxTIMURxx [149]

Answer:

Explanation:

SENN KİMSİİİİİİİİN???

8 0
1 year ago
Read 2 more answers
Hi!
baherus [9]

Answer:

Radius = 14 cm = 0.00014 km

Circumference = 2πr = 2 × 22/7 × 14/100000 = 0.00088 km

As it went thousand times , distance covered = 0.00088 × 1000 = 0.88 km

8 0
3 years ago
By converting a given collection of tables to an equivalent third normal form collection of tables, you remove any problems aris
dolphi86 [110]

Answer:

The answer is "functional".

Explanation:

It's a relation of two attributes, usually between the primary key and other main attributes of a table. It turns the collection of tables into a third standard table array.

  • It allows you to controls the quality of data into the database.  
  • It is the disparity between the positive and weak architecture of the database plays a crucial role.

4 0
3 years ago
Other questions:
  • Classify the given items as belonging to the public domain or protected by copyright law.
    6·2 answers
  • What is the output of this code? import java.util.HashSet; class A { public static void main(String[ ] args) { HashSet set = new
    15·1 answer
  • A field whose data type is ____ can store text that can be used as a hyperlink address
    5·1 answer
  • Truncation is a keyword search technique that helps you find useful variations of a term or terms. You want to find books on the
    5·1 answer
  • SOMEONE PLZZ HELP ME ASAP!!
    15·2 answers
  • 9. DIMMs used in servers can provide additional reliability if they use what specific technology.
    8·1 answer
  • How can i get google assistant on my lava iris 820 smartphone easily???? ​
    10·1 answer
  • What is the limitation of computer<br>​
    5·1 answer
  • PLZZZ HELP!!!!!!!
    12·1 answer
  • Memorex Disks sells computer disk drives with right-of-return privileges. Returns are material and reasonably predictable. Memor
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!