Sunday, March 21, 2010

Digital Clock Using Java Script

Interchanging two number without using third variable

#include
main()
{ void swap(int,int);
int num1,num2;
char ch;
do{
clrscr();
printf("\n Enter two numbers one by one:-\n");
scanf(%d %d",&num1,&num2);
printf("\n Before swaping The Two Numbers are:-%d , %d",num1,num2);
swap(num1,num2);
printf("\n Want to continue? (Y/N):");
ch=getch();
}
while(ch=='y' || ch=='Y');

getch();
}
void swap(int n1,int n2)
{
n1=(n1+n2)-n1;
n2=(n1+n2)-n2;
printf("\n After swaping two numbers become %d , %d",num1,num2);
}

Saturday, March 20, 2010

This is what I feel ........

I always try to concentrate the mind on the present moment.....
Sometime I say Sorry ,It's does not mean that I'm wrong and other person is right,
any relationship is more valuable for me than my ego.
I love to see Sunshine....... I want to touch the sky with my determination.

Multiplication of two matrices using functions

#include
void input_matrix(int[][],int,int);
void output_matrix(int[][],int,int);
void multiply(int[][],int[][],int[][],int,int,int);
main()
{
int mat1[100][100],mat2[100][100],mat3[100][100];
int m,n,l;
char ch;
do
{
clrscr();
printf("\nEnter the no.of rows and columns of 1st matrix:-\n");
scanf("%d %d",&m,&n);
input_matrix(a,m,n);
out_matrix(a,m,n);
printf("\nEnter the no.of rows and columns of 2nd matrix:-\n");
scanf("%d %d",&n,&l);
input_matrix(b,n,l);
out_matrix(b,n,l);
multiply(a,b,c,m,n,l);
printf("\n Do you want to continue?(Y=yes,N=No)\n");
ch=getch();
}
while(ch=='y' || ch== 'Y');

getch();
}
void input_matrix(int a[100],int m,int n)
{
int i,j;
printf("\n Enter the elements of the matrix:-\n");
for(i=0;i {for(j=0;j scanf("%d",&a[i][j]);
}
}
void output_matrix(int a[100],int m,int n)
{
int i,j;
printf("\n Your entered matrix is:-\n");
for(i=0;i {for(j=0;j printf("%d",a[i][j]);
printf("\n");
}
}
void multiply(int a[100],int b[100][100], int c[100][100],int m,int n,int l)
{
int i,j,k;
for(i=0;i for(j=0;j {c[i][j]=0;
for(k=0;k c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
}