C # syntax exercises (1): Basic Data Types

Source: Internet
Author: User
In this example:


Code :
Using system; Class myclass {static void main () {console. writeline ("sbyte type:"); sbyte sbytevar = (sbyte. maxvalue + sbyte. minvalue)/2; console. writeline ("{0}, {1}, {2} \ n", sbyte. minvalue, sbytevar, sbyte. maxvalue); console. writeline ("byte type:"); byte bytevar = (byte. maxvalue + byte. minvalue)/2; console. writeline ("{0}, {1}, {2} \ n", byte. minvalue, bytevar, byte. maxvalue); console. writeline ("Short Type: "); Short callback Var = (short. maxvalue + short. minvalue)/2; console. writeline ("{0}, {1}, {2} \ n", short. minvalue, callback var, short. maxvalue); console. writeline ("ushort type:"); ushort ushortvar = (ushort. maxvalue + ushort. minvalue)/2; console. writeline ("{0}, {1}, {2} \ n", ushort. minvalue, ushortvar, ushort. maxvalue); console. writeline ("int type:"); int intvar = (Int. maxvalue + Int. minvalue)/2; console. WR Iteline ("{0}, {1}, {2} \ n", Int. minvalue, intvar, Int. maxvalue); console. writeline ("uint type:"); uint uintvar = (uint. maxvalue + uint. minvalue)/2; console. writeline ("{0}, {1}, {2} \ n", uint. minvalue, uintvar, uint. maxvalue); console. writeline ("Long TYPE:"); long longvar = (Long. maxvalue + long. minvalue)/2; console. writeline ("{0}, {1}, {2} \ n", long. minvalue, longvar, long. maxvalue); console. writeline ("UlO Ng type: "); ulong ulongvar = (ulong. maxvalue + ulong. minvalue)/2; console. writeline ("{0}, {1}, {2} \ n", ulong. minvalue, ulongvar, ulong. maxvalue); console. writeline ("Float Type:"); float floatvar = (float. maxvalue + float. minvalue)/2; console. writeline ("{0}, {1}, {2} \ n", float. minvalue, floatvar, float. maxvalue); console. writeline ("Double Type:"); double doublevar = (double. maxvalue + double. minvalue )/ 2; console. writeline ("{0}, {1}, {2} \ n", double. minvalue, doublevar, double. maxvalue); console. writeline ("decimal type:"); decimal decimalvar = (decimal. maxvalue + decimal. minvalue)/2; console. writeline ("{0}, {1}, {2} \ n", decimal. minvalue, decimalvar, decimal. maxvalue); console. writeline ("char type:"); char charvar = 'wan'; console. writeline ("{0}, {1} \ n", charvar, ++ charvar); console. writeline ("bool type :"); Bool boolvar = true; console. writeline ("{0}, {1} \ n", boolvar ,! Boolvar); console. writeline ("string type:"); string stringvar = "in case of Delphi blog"; console. writeline ("{0}, Length: {1} \ n", stringvar, stringvar. length); console. readkey ();}}
 
  
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.