using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ReadingString
{
class Program
{
static void Main(string[] args)
{
//A string is a sequence of characters
//Defined within a pair of double quotes
//such as: "Computer Science"
//Use Console.ReadLine() to read data entered by the user
//The Console.ReadLine() reads data in the form of a string
//Example: Ask user to enter firstname and last name
// then, display the full name
string firstname, lastname, fullname;
// read string from user
Console.Write("Enter your first name: ");
firstname = Console.ReadLine();
Console.Write("Enter your last name: ");
lastname = Console.ReadLine();
//concatenate first and last names into full name
//then display the full name.
fullname = firstname + " " + lastname;
Console.Write("Your full name is: ");
Console.Write(fullname);
Console.ReadLine();
}
}
}
No comments:
Post a Comment