Wednesday, September 29, 2010

Sum of upper and lower trangular matrix

/*************************************
* Program TO Find The Sum *
* Of Upper And Lower *
* Trangular Matrix And Find *
* Which Sum Is Greater *
*************************************/
#include
#include
void main()
{
int i,j,row,col,upp,low,el[10][10];
clrscr();
upp=low=0;
printf("enter the size of a square matrix");
scanf("%d%d",&row,&col);
printf("Enter the elements");
for(i=0;i>>>>\n");
for(i=0;ii)
upp=upp+el[i][j];

else if(jlow)
printf("\nSum of Upper Trangular matrix is more");
else if(upp
printf("\nSum of lower trangular matrix is more");
else
printf("\nSum is equal");
getch();
}

A matrix is Symmetric or not

/****************************************
* Program to Chech Wheather *
* a matrix is Symmetric or *
* Not *
****************************************/
#include
#include
void main()
{
  int i,j,row,col,ele[10][10],ele2[10][10],val=0;
  clrscr();
  printf("enter the size of a square matrix**>");
  scanf("%d%d",&row,&col);
  printf("enter %d Elements",row*col);
for(i=0;i
{
for(j=0;j
{
scanf("%d",&ele[i][j]);
}
printf("\n");
}
for(i=0;i
{
for(j=0;j
{
ele2[j][i]=ele[i][j];
}
}
for(i=0;i
{
for(j=0;j
{
if(ele[i][j]==ele[j][i])
{
val++;
}
else
{
val=0;
break;
}
}
}
for(i=0;i
{
for(j=0;j
{
printf("\t%d",ele[i][j]);
}
printf("\n");
}
if(val==(row*col))
{
printf("It's a symmetric matrix");
}
else
{
printf("It's not a symmetric matrix");
}
getch();
}

Decimal to other Number System

/*******************************************
* Program To Convert *
* Dec---binary *
* Dec---Octal *
* Dec---Hexadecimal *
*******************************************/
#include
#include
void main()
{
int bin[50],dec,num,i,len=0,oct[20],val,hex[30];
clrscr();
printf("Enter any Decimal Number");
scanf("%d",&dec);
num=dec;
while(dec>0)
{
dec=dec/2;
len++;
}
printf("%d\n",len);
dec=num;
for(i=0;i0)
{
oct[i]=dec%8;
dec=dec/8;
i++;
}


dec=num;
i--;
printf("value of Decimal To octal>>>>");
while(i>=0)
{
printf("%d",oct[i]);
i--;
}


printf("\n Decimal TO Binary>>>>");
for(i=len-1;i>=0;i--)
{
printf("%d",bin[i]);
}


dec=num;
i=0;
while(dec>0)
{
hex[i]=dec%16;
dec=dec/16;
if(hex[i]>9)
{
val=hex[i]-9;
hex[i]=64+val;
}
i++;
}


i--;
printf("\n Value of Decimal to hexadecimal conversion is");
while(i>=0)
{
if(hex[i]<=9)
printf("%d",hex[i]);
else
printf("%c",hex[i]);
i--;
}
getch();
}

Series Of 9

/* program to print output as ***
*      9 *
*    89 *
*  789 *
* 6789 *
*********************************/
#include
#include
void main()
{
int i,j;
unsigned int num;
clrscr();
printf("enter any positive integer number less thna or equal to 9");
scanf("%d",&num);
for(i=num;i>=1;i--)
{
for(j=1;j<=num;j++)
{
if(j
printf(" ");
else
printf("%d",j);
}
printf("\n");
}
getch();
}

Series of 7531

/* program to print output as
*       1 *
*     31 *
*   531 *
* 7531 *
*****************/
#include
#include

void main()
{
unsigned int i,j,row,num,val;
clrscr();
printf("enter any odd positive integer less than or equal to nine");
scanf("%d",&num);
row=num/2 +1;
val=num;
for(i=row;i>=1;i--)
{
for(j=1;j<=row;j++)
{
if(j<=i-1)
printf(" ");
else
printf("%d",num);

num-=2;
}
num=val;
printf("\n");
}

getch();

}

Program to print serises of ABCDEEDCBA

/**************************************************
********** Program to print output as *************
* ABCDEFEDCBA *
* ABCDE   EDCBA *
* ABCD        DCBA *
* ABC              CBA *
* AB                    BA *
* A                         A *
**************************************************/
#include
#include
void main()
{
  char ch;
  int i,j,m,k;
  clrscr();
  k=0;
  printf("Enter any Character");
  scanf("%c",&ch);
  toupper(ch);
for(i=ch;i>='A';i--)
{
  for(j='A';j<=i;j++) { printf("%c",j); } for(m=0;m='A';m--)
   {
    if(m!=ch)
    printf("%c",m);
   }
   printf("\n");
}
getch();
}

Monday, September 20, 2010

Virtual Machine

A virtual machine was originally defined by Popek and Goldberg as "an efficient, isolated duplicate of a real machine". Current use includes virtual machines which have no direct correspondence to any real hardware.[1]

Virtual machines are separated into two major categories, based on their use and degree of correspondence to any real machine. A system virtual machine provides a complete system platform which supports the execution of a complete operating system (OS). In contrast, a process virtual machine is designed to run a single program, which means that it supports a single process. An essential characteristic of a virtual machine is that the software running inside is limited to the resources and abstractions provided by the virtual machine—it cannot break out of its virtual world.

System virtual machines


System virtual machines (sometimes called hardware virtual machines) allow the sharing of the underlying physical machine resources between different virtual machines, each running its own operating system. The software layer providing the virtualization is called a virtual machine monitor or hypervisor. A hypervisor can run on bare hardware (Type 1 or nativeType 2 VM) or on top of an operating system ( or hosted VM).

The main advantages of system VMs are:

  • multiple OS environments can co-exist on the same computer, in strong isolation from each other
  • the virtual machine can provide an instruction set architecture (ISA) that is somewhat different from that of the real machine
  • application provisioning, maintenance, high availability and disaster recovery[2]

The main disadvantages of system VMs are:

  • a virtual machine is less efficient than a real machine when it accesses the hardware indirectly
  • when multiple VMs are concurrently running on the same physical host, each VM may exhibit a varying and unstable performance, which highly depends on the workload imposed on the system by other VMs, unless proper techniques are used for temporal isolation among virtual machines.

Process virtual machines

A process VM, sometimes called an application virtual machine, runs as a normal application inside an OS and supports a single process. It is created when that process is started and destroyed when it exits. Its purpose is to provide a platform-independent programming environment that abstracts away details of the underlying hardware or operating system, and allows a program to execute in the same way on any platform.

A process VM provides a high-level abstraction — that of a high-level programming language (compared to the low-level ISA abstraction of the system VM). Process VMs are implemented using an interpreter; performance comparable to compiled programming languages is achieved by the use of just-in-time compilation. This type of VM has become popular with the Java programming language, which is implemented using the Java virtual machine. Other examples include the Parrot virtual machine, which serves as an abstraction layer for several interpreted languages, and the .NET Framework, which runs on a VM called the Common Language Runtime
.

Wednesday, September 15, 2010

Thursday, September 2, 2010