systemappsprogram.blogspot.com

C# - Basic Syntax

C# -Basic Flow of Program **\\
using System; 
 namespace RectangleApplication 
{class Rectangle 
{ // member variables  
Image result for c#double length; 
 double width; 
 public void Acceptdetails()  
{  length = 4.5; 
width = 3.5;  
}  public double GetArea()  
{  return length * width; 
 }  public void Display()  
{  Console.WriteLine
 ("Length: {0}", length); Console.WriteLine 
("Width: {0}", width); Console.WriteLine("Area: {0}", 
 GetArea()); } } class ExecuteRectangle 
 { static void Main(string[] args) 
 { Rectangle r = new Rectangle(); 
 r.Acceptdetails(); 
 r.Display();
  Console.ReadLine(); 
 }  }  }/* This program demonstrates 
The basic syntax of C# programming Language *
   using System; 
 namespace DataTypeApplication { 
 class Program { 
 static void Main(string[] args) { 
 Console.WriteLine("Size of int: {0}", sizeof(int)); 
 Console.ReadLine();
  }  } } 
using System; 
 namespace TypeConversionApplication 
 { class ExplicitConversion  
{ static void Main(string[] args)  
{ double d = 5673.74; int i; // cast double to int. 
i = (int)d; Console.WriteLine(i);  
Console.ReadKey(); } } } 
using System; 
 namespace TypeConversionApplication  
{ class StringConversion  
{ static void Main(string[] args)  
{ int i = 75; 
 float f = 53.005f;  
double d = 2345.7652; 
 bool b = true;  
Console.WriteLine(i.ToString()); 
 Console.WriteLine(f.ToString()); 
 Console.WriteLine(d.ToString());  
Console.WriteLine(b.ToString()); 
 Console.ReadKey(); 
 } } }


Share:

No comments:

Translate

Popular Posts

Recent Posts

Support System Software

Customer support is usually one of the key aspects for all companies, both small and large enterprises. Having a reliable customer support system will result in a positive image of your brand and will be a clear sing that you actually care about your clients and put effort into keeping them satisfied. Our team of SaaS experts have collected and tested all popular customer support software services currently available in the market. Our list should allow you to more easily decide which solution will work best for your business. Need our help to upload or customize this blogger template? Contact me with details about the theme customization you need.