Advertisement
alek_

Personal Information Survey In C#

Jun 24th, 2020
404
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.04 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Survey
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.             // Personal information survey
  11.  
  12.  
  13.                     // First Name
  14.  
  15.  
  16.                  Console.WriteLine("   ");  // Empty Space
  17.  
  18.                  Console.WriteLine("   Your First Name : ");  // Asks what's the recipient's first name
  19.  
  20.                  Console.WriteLine("   ");  // Empty Space
  21.  
  22.                  Console.Write("   ");  // Space
  23.  
  24.                  string firstname = Console.ReadLine();  // Stores the person's first name into the variable
  25.  
  26.                  Console.WriteLine("   ");  // Empty Space
  27.  
  28.  
  29.                     // Last Name
  30.  
  31.  
  32.                  Console.WriteLine("   Your First Name Is : " + firstname + ".");  // Answer to your first name
  33.  
  34.                  Console.WriteLine("   ");  // Empty Space
  35.  
  36.                  Console.WriteLine("   Your Last Name : ");  // Asks what's the recipient's last name
  37.  
  38.                  Console.WriteLine("   ");  // Empty Space
  39.  
  40.                  Console.Write("   ");  // Space
  41.  
  42.                  string lastname = Console.ReadLine();  // Stores the person's last name into the variable
  43.  
  44.                  Console.WriteLine("   ");  // Empty Space
  45.  
  46.                  Console.WriteLine("   Your Last Name is : " + lastname + ".");  // Answer to your last name
  47.  
  48.                  Console.WriteLine("   ");  // Empty Space
  49.  
  50.  
  51.                     // Age
  52.  
  53.  
  54.                  Console.WriteLine("   Your Age : ");  // Asks what's the recipient's age
  55.  
  56.                  Console.WriteLine("   ");  // Empty Space
  57.  
  58.                  Console.Write("   ");  // Space
  59.  
  60.                  string years = Console.ReadLine();  // Stores the person's age into a string variable
  61.  
  62.                  int age = Convert.ToInt32(years);  // Converts the string "years" to an int variable
  63.  
  64.                  Console.WriteLine("   ");  // Empty Space
  65.  
  66.                  Console.WriteLine("   You are " + age + " years old.");  // Answer to your age
  67.  
  68.                  Console.WriteLine("   ");  // Empty Space
  69.  
  70.                  Console.Write("   ");  // Space
  71.  
  72.  
  73.                     // Keeps the program running ( Doesn't shut down when it finishes )
  74.  
  75.  
  76.                  Console.ReadLine();  // Program will stay active due to this ReadLine
  77.  
  78.         }
  79.     }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement