Write a program that allows you to input the following data

  • Firstname
  • Surname
  • Address
  • Age (declare as string) then convert to integer.

Procedure:-

1. Go to File -> Take New Project, Select Window Classic DesktopConsole App (.Net Framework).
2. Declare Four Variable (name, surname, address, age).
3. name, surname, address  and age as string value .
4. Console.Write(“ “) is used to Write the data.
5. Enter data will read and Store in variable which is declared above.
6. After Entering all value the output will print.
7. But in age, declare it as string then convert to integer.
8. To  convert string value to integer 
  Convert.ToInt32(Console.ReadLine()).

Code :-

using System;
namespace ConsoleApp1
{
public class Program
{
public static void Main()
{
string name;
string surname;
string address;
string age;
Console.Write("Name: ");
name = Console.ReadLine();
Console.Write("Surname: ");
surname = Console.ReadLine();
Console.Write("Address: ");
address = Console.ReadLine();
Console.Write("Age: ");
age = Convert.ToInt32(Console.ReadLine());
Console.WriteLine();
Console.WriteLine("The Output is:-");
Console.WriteLine("Name :- {0}.", name);
Console.WriteLine("Surname :- {0}.", surname);
Console.WriteLine("Address :- {0}.", address);
Console.WriteLine("Age :- {0}.", age);
}
}
}

Output

Write a program that allows you to input the following data

Write My Essay Services