concept of bool:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.Write("10 > 9 is " + (10 > 9));
Console.ReadLine();
}
}
}
//output is 10 >9 is true
--------------------------------Decimal----------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
decimal price;
decimal discount;
decimal discounet_price;
//compute discounted price;
price = 100.00m;
discount = .10m;
discounet_price = price - (price * discount);
Console.Write("discounted price : $" + discounet_price);
Console.ReadLine();
/*use of decimal it can be accurately represent to 28 decimal places
* decimal constants are followed by suffix m*/
decimal pie = 22m;
decimal result;
result = pie / 7;
Console.Write(result);
Console.ReadLine();
}
}
}
/* check the output... */
---------------------------------Dollar in c sharp-------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
decimal balance;
balance = 100m;
Console.WriteLine("current bqalance is {0:C}", balance);//$100.00
Console.ReadLine();
}
}
}
-------------------------Sqrt-----------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double r;
double area;
area =10.0;
r = Math.Sqrt(area / 3.1416);
Console.WriteLine(r);
Console.ReadLine();
}
}
}
/* area = pie*r*r.... */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.Write("10 > 9 is " + (10 > 9));
Console.ReadLine();
}
}
}
//output is 10 >9 is true
--------------------------------Decimal----------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
decimal price;
decimal discount;
decimal discounet_price;
//compute discounted price;
price = 100.00m;
discount = .10m;
discounet_price = price - (price * discount);
Console.Write("discounted price : $" + discounet_price);
Console.ReadLine();
/*use of decimal it can be accurately represent to 28 decimal places
* decimal constants are followed by suffix m*/
decimal pie = 22m;
decimal result;
result = pie / 7;
Console.Write(result);
Console.ReadLine();
}
}
}
/* check the output... */
---------------------------------Dollar in c sharp-------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
decimal balance;
balance = 100m;
Console.WriteLine("current bqalance is {0:C}", balance);//$100.00
Console.ReadLine();
}
}
}
-------------------------Sqrt-----------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double r;
double area;
area =10.0;
r = Math.Sqrt(area / 3.1416);
Console.WriteLine(r);
Console.ReadLine();
}
}
}
/* area = pie*r*r.... */
No comments:
Post a Comment