fbinnzhivko

BooleanVariable - Declare a Boolean variable called isFemale

Jan 28th, 2016
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.73 KB | None | 0 0
  1. using System;
  2.     class BooleanVariable
  3. {//Declare a Boolean variable called isFemale and assign an appropriate value corresponding to your gender.Print it on the console.
  4.     static void Main()
  5.            {
  6.         bool isFemale = false;
  7.         Console.Write("Are you a female? (Yes/No): ");
  8.         String Answer = Console.ReadLine();
  9.  
  10.         if (Answer == "Yes")
  11.         {
  12.             isFemale = true;
  13.             Console.WriteLine("You are female!");
  14.         }
  15.         else if (Answer == "No")
  16.         {
  17.             isFemale = false;
  18.             Console.WriteLine("Yoy are Male!");
  19.         }
  20.         else
  21.         {
  22.             Console.WriteLine("Invalid Input");
  23.         }
  24.  
  25.        
  26.        
  27.            }
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment