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
tiny-mole [99]
3 years ago
12

Part 1: 1) Write a C program getPhoneNumber.c that accepts a phone number from the user in the form XXX-XXX-XXXX, and then displ

ays it in the form (XXX)XXX-XXXX: Enter a date (XXX-XXX-XXXX): 011-123-4567 You entered (011)123-4567
Computers and Technology
1 answer:
Allushta [10]3 years ago
8 0

Answer:

Following are the program, which can be below:

#include <stdio.h> //defining header file

#include <string.h>//defining header file

int main() //defining main method

{  

int x=0,y=0,l=0; //defining integer variable

char phone_number[32] = {'\0'}; //defining char array

printf("Enter a date(xxx-xxx-xxxx): \n "); //print message

printf("Example: 000-000-0000 \n :"); //print message

scanf("%s",phone_number); // taking input from user

printf("%s\n",phone_number); //print number

for(x=0; phone_number[x]; x++) // check character by character

{

if(x==0) // put ( on first character

{

l = strlen(phone_number); //calculate length  

phone_number[l] = '\0'; //check number  

for(y=l; y>=1; y--) //loop to calculate a value

{

phone_number[y] = phone_number[y-1]; //holding value in array

}

phone_number[y] = '('; //assigning bracket

}

if(phone_number[x] == '-') // put ) at first -

{

phone_number[x] = ')'; //assigning bracket

break;

}

}

printf("You entered %s\n",phone_number); //print all value with brackets

}

Output:

Enter a date(xxx-xxx-xxxx):  

Example: 000-000-0000  

:011-123-4567

011-123-4567

You entered (011)123-4567

Explanation:

The description of the above program can be defined as follows:

  • In the above program three integer variable "x, y, and l" and a character array "phone_number" is declared.
  • In the char, variable user input the value and print its value by using the print function.
  • In the next line, a for loop is declare, that checks user input value character by character and counts its length by using the strlen() method, inside the loop a conditional statement is used.
  • In the condition statement check, the values are not equal to null and provide brackets in the inserted value.
You might be interested in
The retention of encoded information over time refers to
Crank

It refers to Storage

7 0
2 years ago
what is the the process of sending a packet from one host to a selected group of hosts, possibly in different networks?
Burka [1]
I believe it's "multicast"
6 0
3 years ago
What subnet mask can be used to segment the 172.16.0.0 network to allow for a minimum of 6 subnets while maximizing the number o
marishachu [46]

The subnet mask can be utilized to segment the 172.16.0.0 network to qualify for a minimum of 6 subnets while maximizing the numeral of broadcasters per subnet is 255.255.224.0

<h3>What do subnet masks mean?</h3>
  • A subnet mask is a 32-bit numeral formed by setting keeper bits to all 0s and developing network times to all 1s.
  • In this way, the subnet mask divides the IP speech into the network and host addresses.
  • A subnet mask is used to separate an IP address into two pieces. One element defines the host (computer), and the different part identifies the network to which it belongs.
  • To better comprehend how IP lessons and subnet masks work, look at an IP speech and see how it's managed.

To learn more about  subnet mask, refer to:

brainly.com/question/3234986

#SPJ4

5 0
2 years ago
Before you give your presentation to an audience, you should make sure that your ideas are organized in a clear and meaningful w
avanturin [10]

The answer is the second choice, "Re-order."


If your slides are in the wrong order, you can re-order them by dragging them into the correct place on the side toolbar.

8 0
4 years ago
Read 2 more answers
Wireless internet is an example of telecommunications.
lawyer [7]
Anything is telecommunication if it has a <span>transmitter</span> and receiver. If you're a Host, then you're hosting (Transmitting) a connection. If you have a router as a customer or service, then you're receiving their signal (transmitting). You're the receiver. 
7 0
3 years ago
Other questions:
  • Which layer of the osi model defines services to segment and reassemble data for individual communications between end devices?
    15·1 answer
  • propose,two new ,proudly South African ways,which you can visualize that the IoT,can be used at work to make life better.
    12·1 answer
  • How much mobile data does maps use
    6·1 answer
  • An employee who interacts with customers regarding the nature of their car problems, rather than actually working on the vehicle
    12·2 answers
  • Which Boolean operator enables you to exclude a search term?
    9·2 answers
  • you can save your work in BlueGriffion using either _____ or _____. A) the format: secondary toolbar, Wysiwing view. B) The form
    12·1 answer
  • Eric is working on a computer that has a device driver error. Eric can find the name of the device driver however the actual dev
    13·2 answers
  • JAVA Question!
    13·1 answer
  • FREE BRAINLIEST!!!
    14·2 answers
  • Why might you use the More button in the Find and Replace dialog box?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!