පොඩි පොඩි ප්රොග්රම් කෝඩ් දාපල්ලකො අපිටත් PC එකෙ දාල බලන්න
ප්රශ්න තුනක් තියනවා බලපන්.
(1) In Visual Studio, create and test a console application that does the following:
(1) Create three variables of the String data type, named firstName, lastName, and fullName respectively;
(2) Use the built-in function Console.ReadLine() to get the user’s input for firstName and lastName using the following statements:
Console.WriteLine(“Enter your first name:”)
firstName = Console.ReadLine()
Console.WriteLine(“Enter your last name:”)
lastName = Console.ReadLine()
(3) Concatenate the variables firstName and lastName together, and then assign the result to the variable fullName as follows (there is a space between the two double quotes):
fullName = firstName & “ ” & lastName
(4) Use the following statement to display the output:
Console.WriteLine(“Thank you ” & fullName)
(2) In Visual Studio, create and test a console application that does the following:
(1) Create three variables of Integer data type, named x, y, z respectively;
(2) Use the built-in function Console.ReadLine() to get the user’s input for x and y as follows (it is assumed that the user always inputs integers when testing this program):
Console.WriteLine(“Input the first number:”)
x = CType(Console.ReadLine(), Integer)
Console.WriteLine(“Input the second number:”)
y = CType(Console.ReadLine(), Integer)
(3) Compute the smaller of x and y, and then assign the result to z as follows:
If (x < y) then
z = x
Else
z = y
End If
(4) Use the following statements to display the output:
Console.WriteLine(“The smaller of the two numbers is”)
Console.WriteLine(z)
(3) In Visual Studio, create and test a console application that does the following:
(1) Create three variables of Integer data type, named x, y, z respectively;
(2) Use the built-in function Console.ReadLine() to get the user’s input for x, y, z as follows (it is assumed that the user always inputs integers when testing this program):
Console.WriteLine(“Input the first number:”)
x = CType(Console.ReadLine(), Integer)
Console.WriteLine(“Input the second number:”)
y = CType(Console.ReadLine(), Integer)
Console.WriteLine(“Input the third number:”)
z = CType(Console.ReadLine(), Integer)
(3) Display the sum of the three numbers using the following statements:
Console.WriteLine(“The sum of the three numbers is”)
Console.WriteLine(x+y+z)