173k views
2 votes
Write a program that inputs the following information from the user, using the Win32 Read-Console function: first name, last name, age, phone number. Redisplay the same information with labels and attractive formating, using Win32 WriteConsule function.

User Al Belsky
by
7.6k points

1 Answer

4 votes

Answer:

Following are program using c#

using System;

class detail

{

static void Main() // main function

{

string first_name,last_name, number1; // variable declaration

int age1; //variable declaration

Console.WriteLine("Enter the First Name ");

first_name = Console.ReadLine(); // read input by win32

Console.WriteLine("Enter the Last Name ");

last_name = Console.ReadLine(); // read input by win32

Console.WriteLine("Enter the Age ");

age1 = Int32.Parse(Console.ReadLine()); // read input by win32

Console.WriteLine("Enter the Phone Number ");

number1 = Console.ReadLine(); // read input by win32

Console.WriteLine("Following are the data which are entered ");

Console.WriteLine("First Name :"+first_name); // display data

Console.WriteLine("Last Name :"+last_name); // display data

Console.WriteLine("Age :"+age1);//display data

Console.WriteLine("Phone Number:"+number1); // display data

}

}

Step-by-step explanation:

In this program we have declared first_name,last_name, number1 variable as the string type and age1 as integer type after that we are taking input from user by win32 Read console i.e Console.ReadLine() function and finally printed the same information.

Output:

Enter the First Name

san

Enter the Last Name

lan

Enter the Age

45

Enter the Phone Number

9045454545

Following are the data which are entered

First Name :san

Last Name :lan

Age :45

Phone Number :9045454545

User Mranders
by
8.0k points