Built-in-types
In this we will discuss:-
1. Boolean type:- A boolean type is declared with bool keyword and can only take the values true or false.In programming,you will need a data type that can only have one of two values,like:
* YES / NO
* ON / OFF
* TRUE / FALSE
For this,C# has a bool data type,which can take the values true or false.
Syntax:-
using System;
class Program
{
static void Main()
{
bool isCSharpFun = true;
bool isFishTasty = false;
Console.WriteLine(isCSharpFun);
Console.WriteLine(isFishTasty);
}
}
When we run the program,the output will be:-
| True False |
2. Integral Types:- sbyte, byte, short, ushort, int, uint, long, ulong, char
* Sbyte, Short, Int, Long are signed Integer type.
* byte, Ushort, Uint, Ulong are unsigned integer type
3.Floating Types:-
a.) Flaot:- The float data type stores double-precision floating-point numbers with upto 17 significant digit.
b.) double:- The double data type is a double precision 64-bit IEEE 754 floating point.
4. Decimal Types:- 128-bit precise decimal values with 28-29 significant bit.
5. String Type:- The string is a keyword that is useful to represent a sequential collection of characters that is called a text.
Comments
Post a Comment