C# Basic Flashcard

6 flashcards · Programming Languages · by Daniel Blackbird

  1. C# Type Conversion Methods boolean byte char dateTime decimal double int16 int32 int64 sbyte single string type uint16 uint32 uint64

    ToBoolean Converts a type to a Boolean value, where possible. ToByte Converts a type to a byte. ToChar Converts a type to a single Unicode character, where possible. ToDateTime Converts a type (integer or string type) to date-time structures. ToDecimal Converts a floating point or integer type to a decimal type. ToDouble Converts a type to a double type. ToInt16 Converts a type to a 16-bit integer. oInt32 Converts a type to a 32-bit integer. ToInt64 Converts a type to a 64-bit integer. ToSbyte…

  2. write a code that read a character from user

    Console.ReadLine();

  3. write a code that make a int (variable name=>num) and read from user and convert it to int32 and assign it to num

    int num; num = Convert.ToInt32(Console.ReadLine());

  4. what is the output when we use this chars in print . \\ \' \" \? \a \b \f \n \r \t \v \xhh . . .

    \ character ' character " character ? character Alert or bell Backspace Form feed Newline Carriage return Horizontal tab Vertical tab Hexadecimal number of one or more digits

  5. write a code that assign a double constant pi=3.14

    const double pi = 3.14159;

  6. solve problem last line this code const double pi = 3.14159; // constant declaration double r; Console.WriteLine("Enter Radius: "); r = Convert.ToDouble(Console.ReadLine()); double areaCircle = pi * r * r; Console.WriteLine("Radius:, Area: ", r, areaCircle);

    last line