Laplace transforms pdf

CLICK THE LINK BELOW TO DOWNLOAD LAPLACE TRANSFORMS IMPORTANT FORMULAS IN THE FORM OF PDF

CLICK HERE

Friday, 29 July 2016

Selection sorting

/*SELECTION SORT (ASCENDING AND DESCENDING ORDER ORDER) */
#include<stdio.h>
void main()
{
int n,a[1000],i,j,t,m,l;
printf("enter the number of numbers that are to be sorted\n");
scanf("%d",&n);
printf(" enter the elements of the array\n"); for(i=0;i<n;i++)
scanf("%d",&a[i]);

for(i=0;i<n;i++)
	  {
	  	t=i;
	  	for(j=i;j<n;j++)
	  	if(a[t]>a[j])
	  	 {
	  	 	t=j;
	  	 }
	  	if(t!=i)
	  	{
		  
		m=a[i]; 	
		a[i]=a[t];
		a[t]=m;
	    }
		
		
	  }

printf("\n ASCENDING ORDER :\n"); for(i=0;i<n;i++)
printf(" %d ",a[i]);
printf("\n DESCENDING ORDER:\n"); for(i=n-1;i>=0;i--)
printf(" %d ",a[i]);
}

PROGRAM TO CHECK WHETHER THE GIVEN SUDOKU PUZZLE ANSWER IS CORRECT OR NOT

/*Check whether the given filled sudoku puzzle is correct or not */

#include<stdio.h>
#include<conio.h>
void main()
{
int a[9][9],sum1,sum2,flag=0,i,j;      printf("Enter the elements of sudoku Row wise\n");
for(i=0;i<9;i++)
for(j=0;j<9;j++)
scanf("%d",&a[i][j]);
for(i=0;i<9;i++)
{
sum1=0;
sum2=0;
for(j=0;j<9;j++)
{
sum1+=a[i][j];
sum2+=a[j][i];
}
if(sum1!=45 || sum2!=45)
{
flag=1;
break;
}
}
for(i=0;i<9;i++)
{
for(j=0;j<9;j++)
printf(" %d ",a[i][j]);
printf("\n\n");
}
if(flag==1)
printf("\n----THE PUZZLE IS WRONG---\n"); else
printf("\n----THE PUZZLE IS RIGHT---");
}

Sunday, 24 July 2016

Pascal triangle

/*PROGRAM TO PRINT THE PASCAL TRIANGLE  */
#include<stdio.h>
int ncr(int ,int );
int fact(int);
void main()
{
int n,i,j,k;
printf("enter number of rows \n");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(k=(n-i);k>0;k--)
printf(" ");
for(j=0;j<=i;j++)
{
printf("%d ",ncr(i,j));
}
printf("\n");
}
getch();
}

int ncr(int n,int r)
{
return (((fact(n))/(fact(n-r)*fact(r))));
}

int fact(int n)
{
if(n==0)
return 1;
else
return n*fact(n-1);
}

Bubble sort

/*BUBBLE SORT (ASCENDING AND DESCENDING ORDER ORDER) */

#include<stdio.h>
void main()
{
int n,a[1000],i,j,t;
printf("enter the number of numbers that are to be sorted\n");
scanf("%d",&n);
printf(" enter the elements of the array\n");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
     {
   for(j=0;j<n-1-i;j++)
     if(a[j]>a[j+1])
       {
       t=a[j+1];
       a[j+1]=a[j];
         a[j]=t;
         }
      }
printf("\n ASCENDING ORDER :\n"); for(i=0;i<n;i++)
printf(" %d ",a[i]);
printf("\n DESCENDING ORDER:\n"); for(i=n-1;i>=0;i--)
printf(" %d ",a[i]);
}

Saturday, 23 July 2016

C program to find the maximum and minimum of three given numbers by using conditional operators in single line.

/* write a program to print the maximum and minimum of three given numbers */

#include<stdio.h>
void main()
{
int a,b,c,min,max;
printf("enter any three numbers \n");

 scanf("%d %d %d",&a,&b,&c); 

min=((a<b)&&(a<c))?a:(b<c?b:c);

max=((a>b)&&(a>c))?a:(b>c?b:c);
printf("minimum: %d maximum: %d ",min,max);
getch();
}

C program to find the first largest and second largest elements in an array

/*Program to find the first and second largest number in the given array*/

#include<stdio.h>
void main()
{
int a[100];
int n,f=0,s=0,i;
printf("enter the number of elements in the array\n");
scanf("%d",&n);
printf(" \n enter the elements and press enter\n");
for(i=0;(i<n);i++)
   {
     scanf("%d",&a[i]);
  if(a[i]>f)
          {
           s=f;
           f=a[i];
           }
     if((a[i]>s)&&(a[i]<f))
        s=a[i];
    }
printf("%d is the first largest number \n",f); printf("%d is the second largest number \n",s);
}

Friday, 22 July 2016

C program how to find the largest and smallest number in an ARRAY

#include<stdio.h>
void main()
{
int a[100];
int n,f,s,i;
printf("enter the number of elements in the array at least 2 \n");
scanf("%d",&n);
printf(" \n enter the elements and press enter\n");
for(i=0;(i<n);i++)
{
scanf("%d",&a[i]);
if(a[i]>f)
f=a[i];
else if(a[i]<s)
s=a[i];
}
printf("%d is the first largest number \n",f); printf("%d is the smallest number \n",s);
}

/*sample output is shown in the screen shot*/