Monday, December 17, 2012

PROGRAM TO DEMONSTRATE FUNCTION OVER-LOADING

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication14
{
class Demo
{
public void sum()
{
Console.WriteLine("This sum is without any data");
}
public void sum(int a, int b)
{
int p = a;
int q = b;
int s = p + q;
Console.WriteLine("Sum of two int values: "+s);
}
public void sum(int a, int b, int c)
{
int i = a;
int j = b;
int k = c;
int s = i + j + k;
Console.WriteLine("Sum of three int values: "+s);
}
}
class OverLoadDemo
{
static void Main(string[] args)
{
Demo obj = new Demo();
obj.sum();
obj.sum(5,7);
obj.sum(2,7,12);
Console.ReadLine();
}
}
}

<<<<<<<<<<<<<<<<<<<< OUTPUT >>>>>>>>>>>>>>>>>>>>>>>

This sum is without any data
Sum of two int values: 12
Sum of three int values: 21

PROGRAM TO DEMONSTRATE INHERITANCE

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication13
{
class A
{
int a, b, c;
public void show()
{
a = 10;
b = 15;
c=a+b;
Console .WriteLine ("Result of class A: "+c);
}
}
class B : A
{
public void display()
{
Console.WriteLine("We are in class B ");
}
}
class InheritanceDemo
{
static void Main(string[] args)
{
B obj = new B();
obj.show(); //accessing class A's function by B's object
obj.display();
Console.ReadLine();
}
}
}

<<<<<<<<<<<<<<<<<<<<<<< OUTPUT >>>>>>>>>>>>>>>>>>>>>>>

Result of class A: 25

We are in class B

PROGRAM TO GET POWER OF A NUMBER RAISED TO ANOTHER

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication12
{
class Program
 {
static void Main(string[] args)
{
int num, pow, temp;
Console.Write("Enter the number: ");
String strNUM=Console.ReadLine();
num = int.Parse(strNUM);
Console.Write("Enter the power: ");
String strPOW = Console.ReadLine();
pow = int.Parse(strPOW);
temp = num*num;
for (int i = 2; i {
temp = (temp * num);
}
Console.WriteLine("Result= "+temp);
Console.ReadLine();
}
}
}

<<<<<<<<<<<<<<<<<<<<<<<< OUTPUT >>>>>>>>>>>>>>>>>>>>>>>>>>>>

Enter the number:12

Enter the power:2

Result= 144

PROGRAM TO PRINT PYRAMID OF 'O'

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication9
{
class Pyramid
{
static void Main(string[] args)
{
int i, j, k, num;
Console.Write("Please enter the number of layers: ");
String strNUM = Console.ReadLine();
num = int.Parse(strNUM);
for (i = 1; i <= num; i++)
{
for (j = 1; j <= 2 * (num - i) + i; j++)
Console.Write(" ");
for (k = 1; k <= 2 * i - 1; k++)
Console.Write("o");
Console.WriteLine();
}
Console.ReadLine();
}
}
}

<<<<<<<<<<<<<<<<<<<<<<<<<<<< OUTPUT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Please enter the number of layers: 6

o
ooo
ooooo
ooooooo
ooooooooo
ooooooooooo

PROGRAM TO GENERATE FIBONACCI SERIES

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication8
{
class Fabonacci
{
static void Main(string[] args)
{
int num, a, b, c, i;
Console.Write("Enter the Number of TERMS in the series: ");
String strNUM = Console.ReadLine();
num = int.Parse(strNUM);
a = 0;
b = 1;
Console.Write(""+a+" "+b);
for (i = 3; i <= num; i++)
{
c = a + b;
a = b;
b = c;
Console.Write(" "+c);
}
Console.ReadLine();
}
}
}

<<<<<<<<<<<<<<<<<<< OUTPUT >>>>>>>>>>>>>>>>>>>>>>>>>>>>

Enter the Number of TERMS in the series: 5

0 1 1 2 3

PROG. TO CHECK FOR ENTERED CHAR TO BE VOVEL


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication7
{
class Program
{
static void Main(string[] args)
{
char ch;
Console.Write("Enter any character: ");
String STRch = Console.ReadLine();
ch = char.Parse(STRch);
if (ch == 'a'
ch == 'e'
ch == 'i'
ch == 'o'
ch == 'u'
ch == 'A'
ch == 'E'
ch == 'I'
ch == 'O'
ch == 'U')
{
Console.WriteLine("Entered Key is VOVEL");
}
else
{
Console.WriteLine("Entered Key is CONSONANT");
}
Console.ReadLine();
}
}
}



/*----------------Output-------------------------------------*/

Enter any character: d

Entered Key is CONSONANT





PROGRAM TO GENERATE THE TABLE OF A GIVEN NUMBER

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication6
{
class Table
{
static void Main(string[] args)
{
int no, i, temp;
Console.Write("Please Enter a number: ");
String strNo = Console.ReadLine();
no = int.Parse(strNo);
i = 1;
while (i <= 10)
{
temp = i * no;
Console.WriteLine(""+no+" x "+i+" = "+temp);
i++;
}
Console.ReadLine();
}
}
}

/*--------------Output-----------------------------------*/

Please Enter a number: 56

56 x 1 = 56

56 x 2 = 112

56 x 3 = 168

56 x 4 = 224

56 x 5 = 280

56 x 6 = 336

56 x 7 = 392

56 x 8 = 448

56 x 9 = 504

56 x 10 = 560





PROGRAM TO CALCULATE FACTORIAL

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
int num;
int fact=1;
Console.Write("Please enter a number: ");
String strNum = Console.ReadLine();
num = int.Parse(strNum);
if (num == 0)
{
Console.WriteLine("Factorial= 1");
}
else
{
for (int i = num; i > 0; i--)
{
fact = fact * i;
}
Console.WriteLine("Factorial= "+fact);
}
Console.ReadLine();
}
}
}

<<<<<<<<<<<<<<<<<<<<<< OUTPUT >>>>>>>>>>>>>>>>>>>>>>>>>>>

Please enter a number: 0

Factorial= 1
Please enter a number: 1
Factorial= 1
Please enter a number: 2
Factorial= 2
Please enter a number: 5
Factorial= 120


PROGRAM TO REVERSE DIGITS OF ANY ENTERED NUMBER

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int num;
int rem;
int temp = 0;
Console.Write("Please Enter Any Number: ");
String strNum = Console.ReadLine();
num = int.Parse(strNum);
while (num > 0)
{
rem = num % 10;
num = num / 10;
temp = (temp * 10) + rem;
}
Console.WriteLine("The reverse of entered number: "+temp);
Console.ReadLine();
}
}
}
<<<<<<<<<<<<<<<<<<<<<<< OUTPUT >>>>>>>>>>>>>>>>>>>>

Please Enter Any Number: 123

The reverse of entered number: 321



PROGRAM TO CHECK FOR ARMSTRONG NUMBER

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1

{

class Program

{

static void Main(string[] args)

{

int m;

int r;

int temp = 0;

Console.WriteLine("Please Enter Any Number:");

String no = Console.ReadLine();

m=int.Parse(no);

int n = m;

while (m > 0)

{

r = m % 10;

m = m / 10;

temp = temp + (r * r * r);

}

if (n == temp)

Console.WriteLine("The Entered number is armstrong");

else

Console.WriteLine("The entered number is not armstrong");

Console.ReadLine();

}

}

}
<<<<<<<<<<<<<<<<<<<<< OUTPUT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Please Enter Any Number:153

The Entered number is armstrong

Please Enter Any Number:112

The entered number is not armstrong





Wednesday, August 22, 2012

HOW TO CREATE GLOBLE CONNECTION FOR SQL SERVER 2005/8(DB)

1."Initial Catalog=Yas/DBNAME;Data Source=LocalHost;Integrated Security=SSPI"

2.@"Data Source= .\SQLEXPRESS;AttachDbFilename=|DataDirectory|\YAS/DBNAME.mdf; Integrated Security=True"

FOR CLASS FILE

3.public static string conn = @"Data Source=HOME-2D26AB6A95;Initial Catalog=YAS/DBNAME;Integrated Security=True";      

Friday, June 15, 2012

Download Links on Ajax toolkit 4.0 and installation Procedure Link

Windows Sharepoint 2007 Vhd adding for Virtual Pc 2007

Install IIS 7 for windows 7 & vista


1. To open the Windows Features dialog box, click Start, and then click Control Panel
2. In the Control Panel, click Programs


3. Click Turn Windows features on or off.
4. You may receive the Windows Security warning. Click Allow to continue. The Windows Features dialog box is displayed.
 
 5. Expand Internet Information Services. Additional categories of IIS features are displayed. Select Internet Information Services to choose the default features for installation.

6. Expand the additional categories displayed, and select any additional features you want to install, such as Web Management Tools.

 
7. If you are installing IIS 7 for evaluation purposes, you may want to select additional features to install. Select the check boxes for all IIS features you want to install, and then click OK to start installation. 

 
8. The progress indicator appears.


9. When the installation completes, the Windows Features dialog box closes, and the Control Panel is displayed.

 
10. IIS 7 is now installed with a default configuration on Windows Vista or Windows 7. To confirm that the installation succeeded, type the following URL into your browser,  


11. Next, you can use Internet Information Services Manager to manage and configure IIS. To open IIS Manager, click Start, type inetmgr in the Run command box, and then press ENTER.