Respuesta :

Answer:

A very simple C program is as follows:

#include <stdio.h>  // for input output functions

int main()  

 {

    printf("Name : John\n");   //display name

    printf("Date of Birth : 05/02/1993\n");  //displays DOB

    printf("Mobile Number: 98-7654321\n");  //displays mobile number

  }    

Explanation:

Now if you want to take name, date of birth and number from user as input then you can use the following code:

#include <iostream> // for input output functions

using namespace std; // to identify objects like cin cout

/* The function named PersonalInfo that takes input from user and displays name, mobile number and data of birth on output screen */

void PersonalInfo(char name[],char birthdate[], char number[]){

//prompts user to enter name

cout<<"Please enter your name: "<<endl;

cin>>name; //stores name entered by the user

//prompts user to enter his dob in the format given in the bracket

cout<<"Please enter your birthdate (dd/mm/yyyy): "<<endl;

cin>>birthdate; //stores dob entered by the user

//prompts user to enter his mobile number in the given format

cout<<"Please enter your mobile number (xx-xxx-xxxxxxx): "<<endl;

cin>>number; //holds the digits entered by the user

cout<<"Your name is: "<<name<<endl; //displays name

cout<<"Your birthdate is:"<< birthdate<<endl; //displays date of birth

cout<<"Your mobile number is: "<<number<<endl; } //displays number

int main() //start of main() function body

{   char username[30],dob[30],phone[30];

/*three char type arrays that contain name of user in username, date of birth in dob and phone number in phone array */

   PersonalInfo(username,dob,phone);  } //calls function PersonalInfo()

Output:

Please enter your name: John

Please enter your birthdate (dd/mm/yyyy): 09/05/1993

Please enter your mobile number (xx-xxx-xxxxxxx): 91-123-4567890

Your name is: John

Your birthdate is: 09/05/1993

Your mobile number is: 91-123-4567890