20th Day
Hey Guys, I hope that you are Enjoying with my blogs and in previous blog we have learned about Basic concepts of C#, Class Libraries and Reusability and Today's we will see Data type of C# .
- .NET is a free, cross-platform, open source developer platform for building many different types of applications.
- .NET Core is a cross-platform .NET implementation for websites, servers, and console apps on Windows, Linux, and macOS.
Data Type
Data type specifies the size and type of variable values .It is important to use the correct datatypes of corresponding variable. C# is strongly typed language.
- Numeric data types in C# must used for numbers are int( whole number) and double(floating point numbers)..int i = 10; // Now focus on integer and double.decimal y = 10.45;double z = 10.23;float t = 10;string x = "shiv123";bool b = true;
- To find the the Min and Max values of int, double float etc.
- To find Min and Max values of Int16(short) , Int32(int), Int64(long) etc.
- Input:static void Main(string[] args){// numericalConsole.WriteLine("Min & Max value of short(Int16) ");Console.Write(short.MinValue );Console.Write(" to ");Console.WriteLine(short.MaxValue );Console.Write("\n");Console.WriteLine("Min & Max value of int(Int32) ");Console.Write(int.MinValue);Console.Write(" to ");Console.WriteLine(int.MaxValue);Console.Write("\n");Console.WriteLine("Min & Max value of long(Int64) ");Console.Write(long.MinValue);Console.Write(" to ");Console.WriteLine(long.MaxValue);Console.Write("\n");Console.WriteLine("Min & Max value of double");Console.Write(double.MinValue );Console.Write(" to ");Console.WriteLine(double.MaxValue );Console.Read();}
- int16 : It is called short which values lies between -32768 to 32767 or 2 raise 16/2.Which can used it for age ,weight or small use it gives two types like Signed value it can hold +ve values as well as -ve. while in unsigned only +ve value can holds.
- And signed and unsigned values for all data types like double, float etc.
- int32 : It is simply called int which values lies between -2147483648 to 2147483647. Which can used greater value than int16.
- int64 :It is called long which values lies between -9223372036854775808 to 9223372036854775807. Which can used for long values.
Output:
Must Watch this video for more details learn..
Thank You...!
No comments:
Post a Comment