/* Random Phone Numbers (10 points) Write a complete C program that generates 10 random phone numbers and prints them on the screen. The numbers must be formatted as shown in the example given below. The 10 numbers must be different every time your program is called. The program is not required to check if these are valid phone numbers (e.g., some of them may start with a zero or the area code may be invalid). SAMPLE RUN: (142)-677-8454 (445)-443-5049 (280)-766-7669 (776)-046-4139 (432)-903-8187 (901)-893-4787 (067)-439-5665 (107)-037-6924 (775)-917-8436 (237)-906-3133 */ #include #include #include int main(void) { int n, d; int p[10]; // an array to store each 10-digit number srand ( time(NULL) ); // initialize the random number generator for(n=0; n<10; n++) // ten numbers { for(d=0; d<10; d++) // ten digits in each phone number p[d] = rand()%10; printf("(%d%d%d)-",p[0], p[1], p[2]); // print the area code printf("%d%d%d-", p[3], p[4], p[5]); // print 3 digits printf("%d%d%d%d", p[6], p[7], p[8], p[9]); // print 4 digits printf("\n"); } system("pause"); }