Untitled
unknown
plain_text
a year ago
2.1 kB
19
Indexable
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp20
{
internal class Program
{
static void Main(string[] args)
{
// String Type
Console.WriteLine("Enter your username:");
string username = Console.ReadLine();
// Integer Type
Console.WriteLine("Enter your age:");
int age = Convert.ToInt32(Console.ReadLine());
// Float Type
Console.WriteLine("Enter your height in meters (e.g., 1.75):");
float height = float.Parse(Console.ReadLine());
// Double Type
Console.WriteLine("Enter your annual income (e.g., 50000.75):");
double annualIncome = double.Parse(Console.ReadLine());
// Decimal Type
Console.WriteLine("Enter your savings (e.g., 10000.50):");
decimal savings = decimal.Parse(Console.ReadLine());
// Boolean Type
Console.WriteLine("Do you have a driver's license? (true/false):");
bool hasDriverLicense = bool.Parse(Console.ReadLine());
// Character Type
Console.WriteLine("Enter your blood type (e.g., O):");
char bloodType = Convert.ToChar(Console.ReadLine());
// Address Type (String for simplicity)
Console.WriteLine("Enter your address:");
string address = Console.ReadLine();
// Displaying the collected data
Console.WriteLine("\nCollected Information:");
Console.WriteLine($"Username: {username}");
Console.WriteLine($"Age: {age}");
Console.WriteLine($"Height: {height} meters");
Console.WriteLine($"Annual Income: {annualIncome}");
Console.WriteLine($"Savings: {savings}");
Console.WriteLine($"Driver's License: {hasDriverLicense}");
Console.WriteLine($"Blood Type: {bloodType}");
Console.WriteLine($"Address: {address}");
}
}
}
Editor is loading...
Leave a Comment