Tuesday, 23 July 2013

E-Commerce

/* 1. Write a program to find the modular arithmatic
Eg. 27/5 result in r = 5
   -18/4 result in r=10
*/
#include<iostream.h>
#include<conio.h>
int main()
{
    int no1, no2;
    clrscr();

    cout << "Enter the two no : ";
    cin >> no1 >> no2;

    if(no1>0 && no2 >0)
    {
cout << no1 << " mod " << no2 << " = " << no1%no2;
    }
    else
    {
cout << no1 << " mod " << no2 << " = " << (no1%no2)+no2;
    }


    getch();
    return 0;
}

// 2. check a congruence to b (mod n) or not
#include<iostream.h>
#include<conio.h>
int main()
{
    int no1, no2, no;
    clrscr();

    cout << "Enter a and b : ";
    cin >> no1 >> no2;
    cout << "Enter n : ";
    cin >> no;

    if( (no2-no1)%no == 0)
    {
cout << no2 << " = " << no1 << " (mod " << no << ")";
    }
    else
    {
cout << no2 << " != " << no1 << " (mod " << no << ")";
    }


    getch();
    return 0;
}

// 3. fIND ADDITIVE INVERSE FOR NO1 OR PERTICULAT Zm
#include<iostream.h>
#include<conio.h>
int main()
{
    int no1, no;
    clrscr();

    cout << "Enter No1 : ";
    cin >> no1 ;
    cout << "Enter n : ";
    cin >> no;

    for( int i=1; i<no; i++ )
    {
if((no1+i)%no == 0)
   cout << "Additive inverse = (" << no1 << " , " << i << ")";
    }

    getch();
    return 0;
}

// 4. pairs of additive and multiplicative invese
#include<iostream.h>
#include<conio.h>
int main()
{
    int no1, no, i, j, temp;
    clrscr();

    cout << "Enter n : ";
    cin >> no;
    for(i=0; i<=no/2 ;i++)
    {
      for( j=1; j<no; j++ )
      {
if((i+j)%no == 0)
   cout << "(" << i << " , " << j << ")" << endl;
      }
    }
    // Multiplicative inverse
    cout << endl << "Multiplicative Inverse " << endl ;
    for(i=0; i<(no/2)+1 ;i++)
    {
      for( j=1; j<no; j++ )
      {
if((i*j)%no == 1 && i==j)
   cout << "(" << i << " , " << j << ")" << endl;
      }
      for( j=1; j<no; j++ )
      {
if((i*j)%no == 1 && i!=j)
   cout << "(" << i << " , " << j << ")" << endl;
      }
    }
    getch();
    return 0;
}

// 5. fIND MULTIPLICATIVE INVERSE FOR NO1 OR PERTICULAT Zm
#include<iostream.h>
#include<conio.h>
int main()
{
    int no1, no;
    clrscr();

    cout << "Enter No1 : ";
    cin >> no1 ;
    cout << "Enter n : ";
    cin >> no;

    for( int i=1; i<no; i++ )
    {
if((no1*i)%no == 1)
   cout << "multiplicatve inverse = (" << no1 << " , " << i << ")";
    }

    getch();
    return 0;
}

// 6. write a program to find Multiplicative inverse using extended eculidian algorithm
#include<iostream.h>
#include<conio.h>
int main()
{
    int no1, no2, r1, r2, r=0, q, t1=0, t2=1, t=0;
    clrscr();

    cout << "Enter the two no : ";
    cin >> no1 >> no2;
    r1 = no1;
    r2 = no2;
cout << "q\t|r1\t|r2\t|r\t|t1\t|t1\t|t" << endl;
    while(r2>0)
    {
q=r1/r2;

r=r1-(q*r2);
t=t1-(q*t2);
cout << "*********************************************************" << endl;
cout << q << "\t|" << r1 << "\t|" <<  r2 << "\t|" << r << "\t|" << t1 << "\t|" << t2 << "\t|" << t << endl;

r1 = r2;
r2 = r;

t1 = t2;
t2 = t;
    }
    cout << "*********************************************************" << endl;
    cout << "\t|" << r1 << "\t|" <<  r2 << "\t|\t|" << t1 << "\t|" << t2 << "\t|" << endl;
    getch();
    return 0;
}

Monday, 22 July 2013

Core Java

Write a java program to count the frequency of words
import java.io.*;
import java.util.*;
public class FrequencyOfWords
{

    public static void main(String[] args)
    {
        System.out.print("\nEnter Some Text:");

        Scanner input=new Scanner(System.in);

        String text = input.nextLine();
        String ans = "";
        do
        {

            System.out.print("\nEnter A Word You Want To Verify The Frequency:");
            String word = input.nextLine();

            int count = 0;

            StringTokenizer st = new StringTokenizer(text);

            while (st.hasMoreTokens())
            {
                if (st.nextToken().equals(word))
                {
                    count++;
                }
            }

            System.out.println("\nFrequency of \"" + word + "\" is " + count + " times");
            System.out.print("\nDo You Want Verify The Frequency Of One More Word[Y/N]:");

            ans = input.nextLine();
        } while (ans.equals("Y") || ans.equals("y"));
    }

}
Click Here to Download










Write a program to store coordinates ( x, y, z) for data points in 3 Dimensional space. Prompt for how many points to consider and then collect the coordinates as x1, y1, z1, x2, y2, z2, ........ xn, yn, zn (Where n is the number of data points. ). Find the distances among all pairs of points and then display the pair of points having the minimum distance as given by the formula
Distance = Sqrt [ (x1-x2)^2 + (y1-y2)^2 +   (z1-z2)^2 ] 

import java.util.Scanner;
import java.lang.*;

public class Distance
{
double dist[] = new double [10];
double d;
int count=0;
double x1, x2, y1, y2, z1, z2;
double min;


public void distance(double xx1, double yy1, double zz1, double xx2, double yy2, double zz2)
{
dist[count] = Math.sqrt( ((xx1-xx2)*(xx1-xx2)) + ((yy1-yy2)*(yy1-yy2)) + ((zz1-zz2)*(zz1-zz2)) );
System.out.println("The distance between the two points is (" + xx1 + "," + yy1 + "," + zz1 + ") (" + xx2 + "," + yy2 + "," + zz2 + ") = "+ dist[count] + " .");

    if(count>0)
    {
if(dist[count]<dist[count-1])
{
min=dist[count];

x1=xx1;y1=yy1;z1=zz1;x2=xx2;y2=yy2;z2=zz2;

}
}
else
{
min=dist[count];
x1=xx1;y1=yy1;z1=zz1;x2=xx2;y2=yy2;z2=zz2;
}count++;
    }
public static void main(String[] args)
{
double x[][] = new double [10][10];
double y[][] = new double [10][10];
double z[][] = new double [10][10];
int no,temp=0;

Scanner scan = new Scanner (System.in);

System.out.println("Enter the number of points : ");
no = scan.nextInt();

for(int i=0; i<no; i++)
{
for(int j=0; j<3; j++)
{
System.out.println("Enter the x coordinate for point: "+ i + " " + j);
x[i][j] = scan.nextDouble();
}
}

Distance obj = new Distance();

for(int i=0; i<no-1; i++)
{
for(int j=i+1; j<no; j++)
{
obj.distance(x[i][0],x[i][1],x[i][2],x[j][0],x[j][1],x[j][2]);
}
}
System.out.println("The Shortest distance between the two points is (" + obj.x1 + "," + obj.y1 + "," + obj.z1 + ") (" + obj.x2 + "," + obj.y2 + "," + obj.z2 + ") = "+ obj.min + " .");
}
}
Click Here to Download












Monday, 28 January 2013

CONSM Practical-3

3. Find coefficient of variation and co-efficient of skewness for the given data for discrete and continuous frequency distribution
#include<stdio.h>
#include<conio.h>
#include<math.h>
void discrete();
void continuous();
void main()
{
    int ch;
    clrscr();

    do
    {
        printf("\n\n1. Discrete Data\n2. Continious Data 3. Exit\n");
        printf("\nEnter Choice : ");
        scanf("%d",&ch);

        switch(ch)
        {
            case 1:discrete();break;
            case 2:continuous();break;
        }

    }while(ch<3);

    getch();
}

void discrete()
{
    float *xi,*fi,*cfi,i,n,ch,tot=0,totfi=0;
    float midfi,am,m,sd,ex=0.0,ex2=0.0,efx2=0.0;

    printf("\nFor Discrete Data\n");
    printf("\nEnter Number of Elements : ");
    scanf("%f",&n);

    xi=new float[n];
    fi=new float[n];
    cfi=new float[n];

    printf("\nEnter All xi : ");
    for(i=0;i<n;i++)
        scanf("%f",&xi[i]);

    printf("\nEnter Frequency : ");
    for(i=0;i<n;i++)
    {
        scanf("%f",&fi[i]);
        tot+=fi[i]*xi[i];
        totfi+=fi[i];
    }

    cfi[0]=fi[0];
    for(i=1;i<n;i++)
        cfi[i]=cfi[i-1]+fi[i];

    am=tot/float(totfi);
    for(i=0;i<n;i++)
    {
        ex+=(xi[i]-am);
        ex2+=(xi[i]-am)*(xi[i]-am);
        efx2+=fi[i]*(xi[i]-am)*(xi[i]-am);
    }

    printf("\n\nxi\tfi\tcfi\t(xi-x)\t(xi-x)^2f(xi-x)^2");
    for(i=0;i<n;i++)
        printf("\n%.2f\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f",xi[i],fi[i],cfi[i],(xi[i]-am),(xi[i]-am)*(xi[i]-am),fi[i]*(xi[i]-am)*(xi[i]-am));
      
    midfi=cfi[n-1]/2.0;
    for(i=0;i<n;i++)
    {
        if(midfi>cfi[i])
            m=xi[i+1];
    }

    sd=sqrt(efx2/float(totfi));
    printf("\n\nMean : %.2f\nS.D. : %.2f\nMedian : %.2f",am,sd,m);
    printf("\n\nCoEfficient of Variation : %.2f",(sd/am)*100);
    printf("\nCoEfficient of Skewness : %.2f",(3*(am-m))/sd);

}
void continuous()
{
    int *ll,*hl,l,h,interval,n=0,i,fl,f,xl;
    float *xi,*fi,*cfi,ch,tot=0,totfi=0;
    float midfi,mid,am,m,sd,ex=0.0,ex2=0.0,efx2=0.0;

    printf("\nFor Continuous Data\n");
    printf("\nEnter Minimum Lowest Limit : ");
    scanf("%d",&l);

    printf("\nEnter Maximum Heighest Limit : ");
    scanf("%d",&h);

    printf("\nEnter Interval : ");
    scanf("%d",&interval);

    for(i=0;i<(h-l)/interval;i++)
        n++;

    ll=new int[n];
    hl=new int[n];
    xi=new float[n];
    fi=new float[n];
    cfi=new float[n];

    printf("\nEnter Frequency : ");
    for(i=0;i<n;i++)
    {
        ll[i]=l+i*interval;
        hl[i]=ll[i]+interval;
        xi[i]=(ll[i]+hl[i])/2.0;

        scanf("%f",&fi[i]);
        tot+=fi[i]*xi[i];
        totfi+=fi[i];
    }

    cfi[0]=fi[0];
    for(i=1;i<n;i++)
        cfi[i]=cfi[i-1]+fi[i];

    am=tot/float(totfi);
    for(i=0;i<n;i++)
    {
        ex+=(xi[i]-am);
        ex2+=(xi[i]-am)*(xi[i]-am);
        efx2+=fi[i]*(xi[i]-am)*(xi[i]-am);
    }

    printf("\n\nxi\tfi\tcfi\t(xi-x)\t(xi-x)^2f(xi-x)^2");
    for(i=0;i<n;i++)
        printf("\n%.2f\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f",xi[i],fi[i],cfi[i],(xi[i]-am),(xi[i]-am)*(xi[i]-am),fi[i]*(xi[i]-am)*(xi[i]-am));
      

    midfi=cfi[n-1]/2.0;
    for(i=0;i<n;i++)
    {
        if(midfi>cfi[i])
        {
            m=xi[i+1];
            xl=ll[i];
            (i!=0)?(fl=fi[i-1]):(fl=0);
            f=fi[i];
        }
    }

    mid=xl+(((m-fl)/f)*interval);
    sd=sqrt(efx2/float(totfi));
    printf("\n\nMean : %.2f\nS.D. : %.2f\nMedian : %.2f",am,sd,m);
    printf("\n\nCoEfficient of Variation : %.2f",(sd/am)*100);
    printf("\nCoEfficient of Skewness : %.2f",(3*(am-mid))/sd);

}
Click Here to Download
OUTPUT
Discrete Data

Continuous Data


Wednesday, 16 January 2013

DS practical 2

1. Write a program to check whether a given string is palindrome or not using pointer and array.
#include<stdio.h>
#include<conio.h>
void palindrom(char *str)
{
    int flag=0,i,j,no;
    no=strlen(str);

    for(i=0, j=no-1; i<no/2; i++,j--)
    {
        if(str[i] != str[j])
        {
            flag=1;
            break;
        }
    }
    if(flag==0)
        printf("\n\nString is palindrom");
    else
        printf("\n\nString is not palindrom");
}
void main()
{
    char str[50];
    clrscr();
    printf("Enter the string : ");
    scanf("%s",&str);
    palindrom(str);
    getch();
}
Click here to Download

2. Implement a program for given problem
    Search a string if search sucessfully than replace the search string with a new string
#include<stdio.h>
#include<conio.h>
int stlen(char str[50])
{
    int len = 0;
    while(str[len]!='\0')
        len++;
    len--;
    return len;
}
void strRep(char str1[50], char str2[50])
{
    int i = 0,len = 0;
    while(str1[len]!='\0')
        len++;

    while(str2[i]!='\0')
    {
        str1[len] = str2[i];
        i++;
        len++;
    }
    str1[len] = '\0';
}
void main()
{
    char str1[50], str2[50], str3[50], temp[50];
    int len1, len2, len3, i, j, match, k;
    clrscr();

    printf("\n\n\t Enter a sentance : ");
    gets(str1);
    len1 = stlen(str1);

    printf("\n\n\t Enter the string which you want to find :");
    gets(str2);
    len2 = stlen(str2);

    printf("\n\n\t Enter new string which you want to replace : ");
    gets(str3);
    len3 = stlen(str3);

    for(i=0;i<=len1;i++)
    {
        match = 1;
        for(j=0;j<=len2;j++)
        {
            if(str2[j]!=str1[i+j])
            {
                match = 0;
                break;
            }
        }
        if(match)
        {
            for(k=0,j=i+len2+1;j<=len1;j++,k++)
                temp[k] = str1[j];

            temp[k] = '\0';

            for(j=0;j<=len3;j++)
                str1[i+j] = str3[j];

            str1[i+j] = '\0';

            strRep(str1,temp);
            len1 = len1 - len2 +len3;
            i = i + j;
        }
    }
    printf("\n\n\t OUTPUT IS: ");
    puts(str1);
    getch();
}
Click here to Download
3. Implement following inbuilt function using UDF
    (i)   strupr
    (ii)  strlwr

#include<stdio.h>
#include<conio.h>
void strUpper(char s1[]);
void strLower(char s1[]);
void main()
{
      char str[50];
      clrscr();
      printf("Enter the string : ");
      scanf("%s",&str);
      if(str[0]>=97 && str[0] <= 122)
    strUpper(str);
      else if(str[0]>=65 && str[0] <= 90)
    strLower(str);
      getch();
}
void strUpper(char s1[50])
{
    int i;
    for(i=0;s1[i]!='\0';i++)
    {
        if(s1[i]>=97 && s1[i] <= 122)
        {
            s1[i]=s1[i]-32;
        }
    }
    printf("\n String is : %s",s1);
}
void strLower(char s1[50])
{
    int i;
    for(i=0;s1[i]!='\0';i++)
    {
        if(s1[i]>=65 && s1[i] <= 90)
        {
            s1[i]=s1[i]+32;
        }
    }
    printf("\n String is : %s",s1);
}
Click here to Download

Sunday, 6 January 2013

CONSM Practical - 1


1. Generate frequency distribution table for the given raw data (discrete and continuous distribution ) for continuous distribution use inclusion and exclusion method.
 Developed By : Bhavin Tank           
 Date : 05/12/2012                                         
 
#include<stdio.h>
#include<conio.h>
void main()
{
    int arr[30],min,max,i,c,j,n,ch,k,interval,ch1,temp;
    int *fre;
    clrscr();

    printf("Enter the no of frequency  : ");
    scanf("%d",&n);

    printf("\nEnter %d values\n\n",n);
    for(i=0;i<n;i++)
    {
        printf("\t%d - ",i+1);
        scanf("%d",&arr[i]);
    }
    for(i=0;i<n;i++)
    {
        printf("%d, ",arr[i]);
    }
    min=arr[0];
    max=arr[0];
    for(i=0;i<n;i++)
    {
        if(arr[i]<min)
            min=arr[i];
        if(arr[i]>max)
            max = arr[i];
    }
    printf("\n\n= = = = = M E N U = = = = = \n\n");
    printf("1. Distcrete Distribution Table\n\n");
    printf("2. Continuous Distribution Table\n\n");
    printf("= = = = = = = = = = = = = = = = =\n\n");
    printf("Please Enter your choice : ");
    scanf("%d",&ch);
    switch(ch)
    {
      case 1:
       fre = (int *)malloc(max-min+1);
       for(i=0;i<max-min+1;i++)
       {
        fre[i]=0;
       }
       for(j=0;j<n;j++)
       {
        c=0;
        for(i=min;i<=max;i++)
        {
            if(arr[j]==i)
            {
                fre[c]++;
                break;
            }
            c++;
        }
       }
       printf("\n\n\n\n\tDistrete Frequency Table");
       printf("\n\t=============================\n");
       printf("\n\t\tclass\tfrequency");
       printf("\n\t\t=====\t=========\n");
       for(i=min,c=0;i<=max;i++,c++)
       {
        printf("\n\t\t%d\t%d\n",i,fre[c]);
       }
       printf("\n\t=============================");
       printf("\n\n\t\tTotal\t%d",n);
       break;
      case 2:
       printf("\n\n= = = = = M E N U = = = = = \n\n");
       printf("\n\n1. Inclusive Method");
       printf("\n2. Exclusive Method\n");
       printf("\n=============================");
       printf("\n\nPlease enter your choice : ");
       scanf("%d",&ch1);
       if((max-min)<50)
         k = 5;
       else if((max-min)<100)
         k = 10;
       else if((max-min)<200)
         k = 15;
       else
         k = 20;
       switch(ch1)
       {
        case 1:
        printf("\n= = = Continuous Distribution using Inclusion method = = =\n");
            fre = (int *)malloc(k);
            interval = (int)(max-min)/k+1;
            printf("\nInterval : %d",interval);
            for(i=0;i<k;i++)
            {
            fre[i]=0;
            }
            for(j=0;j<n;j++)
            {
            c=0;
            for(i=min;i<=max;i=i+interval)
            {
                if(arr[j]>=i&&(arr[j]<i+interval))
                {
                    fre[c]++;
                    break;
                }
                c++;
            }
            }
            printf("\n\n\n\tInclusive Continuous Frequency Table");
            printf("\n\t=============================\n");
            printf("\n\t\tclass\tfrequency");
            printf("\n\t\t=====\t=========\n");
            for(i=min,c=0;i<=max;i=i+interval,c++)
            {
            printf("\n\t\t%d-%d\t%d\n",i,i+interval,fre[c]);
            }
            printf("\n\t=============================");
            printf("\n\n\t\tTotal\t%d",n);
            break;
      case 2:
        printf("\n= = = Continuous Distribution using Exclusive method = = =\n");
            fre = (int *)malloc(k);
            interval = (int)(max-min)/k+1;
            printf("\nInterval : %d",interval);
            for(i=0;i<k;i++)
            {
            fre[i]=0;
            }
            for(j=0;j<n;j++)
            {
            c=0;
            for(i=min;i<=max;i=i+interval)
            {
                if(arr[j]>=i&&(arr[j]<i+interval))
                {
                    fre[c]++;
                    break;
                }
                c++;
            }
            }
            printf("\n\n\n\tExclusive Continuous Frequency Table");
            printf("\n\t=============================\n");
            printf("\n\t\tclass\tfrequency");
            printf("\n\t\t=====\t=========\n");
            for(i=min,c=0;i<=max;i=i+interval,c++)
            {

            if(i==min)
            {
                printf("\n\t\t%d-%d\t%d\n",i,i+interval,fre[c]);
                temp=i+interval+1;
            }
            else
            {
                printf("\n\t\t%d-%d\t%d\n",temp,i+interval,fre[c]);
            }
            temp=i+interval+1;
            }
            printf("\n\t=============================");
            printf("\n\n\t\tTotal\t%d",n);
            break;

      default:
        printf("Invalid choice");
        break;
       }
    }
    getch();
}
Click Here to Download

Saturday, 5 January 2013

Data Structure Using C

Practical 1

1. write a program to interchange the largest and smallest number from an array and also display its position.
#include<stdio.h>
#include<conio.h>
void swapMinMax(int arr[],int no)
{
int min = arr[0];
int max = arr[0];

int i,p_min=0,p_max=0,temp;
for(i=0;i<no;i++)
{
if(min>arr[i])
{
min=arr[i];
p_min=i;
}
if(max<arr[i])
{
max=arr[i];
p_max=i;
}
}

printf("\n\nminimum value is %d at a[%d] position",min,p_min);
printf("\n\nmaximum value is %d at a[%d] position",max,p_max);

temp = arr[p_min];
arr[p_min] = arr[p_max];
arr[p_max] = temp;
}
void main()
{
int a[50],i,no;
clrscr();

printf("\n\nEnter the size of the array: ");
scanf("%d",&no);

printf("\n\nEnter %d elements in to the array: \n\n", no);
for(i=0;i<no;i++)
{
printf("Enter value at a[%d] = ",i);
scanf("%d",&a[i]);
}
printf("\n\n= = = Before swap the value = = = ");
swapMinMax(a,no);

printf("\n\n= = = after swap the value = = = ");
swapMinMax(a,no);
getch();
}
Click Here to Download
2. write a program to find the second largest number using an array of n numbers.                   
#include<stdio.h>
#include<conio.h>
void main()
{
            int a[50],size,i,j=0,big,secondbig;
            clrscr();
            printf("\n\nEnter the size of the array: ");
            scanf("%d",&size);

            printf("\n\nEnter %d elements in to the array: \n\n", size);
            for(i=0;i<size;i++)
            {
                        printf("Enter value at a[%d] = ",i);
                        scanf("%d",&a[i]);
            }
            big=a[0];
            for(i=1;i<size;i++)
            {
                  if(big<a[i])
                  {
                          big=a[i];
                          j = i;
                  }
            }
            secondbig=a[size-j-1];
            for(i=1;i<size;i++)
            {
                        if(secondbig <a[i] && j != i)
                        secondbig =a[i];
            }
            printf("\n\nSecond biggest: %d", secondbig);
            getch();
}
3. write a program to delete a number from a given location an array.
#include<stdio.h>
#include<conio.h>
void main()
{
            int arr[10], i, j, size, no,flag;
            clrscr();
            printf("Enter the size of an array : ");
            scanf("%d",&size);

            printf("\nEnter %d elements in array \n\n", size);
            for(i=0;i<size;i++)
            {
                printf("arr[%d] = ",i);
                scanf("%d",&arr[i]);
            }
            printf("\n\nEnter the element for deletion :");
            scanf("%d",&no);

            for(i=0;i<size;i++)
            {
               if(no==arr[i])
               {
                        for(j=i;j<size;j++)
                           arr[j]=arr[j+1];
                        size--;
                        flag=0;
                        break;
               }
               else
               {
                        flag=1;
               }
            }

            if(flag==1)
               printf("\nElement not found in array ");
            else
            {
                for(i=0;i<size;i++)
                {
                        printf("\narr[%d] = %d",i,arr[i]);
                }
            }
            getch();
}
4. write a program to transpose the n x n matrix.
#include<stdio.h>
#include<conio.h>
void main()
{
   int row, column, i, j, matrix[10][10], transpose[10][10];
   clrscr();
   printf("Enter the number of rows : ");
   scanf("%d",&row);
   printf("Enter the number of columns : ");
   scanf("%d",&column);
   printf("\nEnter the elements of matrix \n");

   for(i=0 ; i<row ; i++)
   {
      for( j=0 ; j<column ; j++ )
      {
             printf("matrix[%d] = ",i);
             scanf("%d",&matrix[i][j]);
      }
   }

   printf("\n\nentered matrix is :\n\n");
   for( i=0 ; i<row ; i++ )
   {
      for( j=0 ; j<column ; j++ )
      {
             printf("%d\t",matrix[i][j]);
      }
      printf("\n");
   }

   for( i=0 ; i<row ; i++ )
   {
      for( j=0 ; j<column ; j++ )
      {
             transpose[j][i] = matrix[i][j];
      }
   }
   printf("\n\nTranspose of entered matrix :-\n");
   for( i=0 ; i<column ; i++ )
   {
      for( j=0 ; j<row ; j++ )
      {
             printf("%d\t",transpose[i][j]);
      }
      printf("\n");
   }
   getch();
}
Click Here to Download
5. write a program to find greatest three integer using pointer and user define function.
#include<stdio.h>
#include<conio.h>
void swap(int *no1,int *no2, int *no3)
{
            if( *no1>*no2 && *no1>*no3 )
                        printf("\n\n\t %d is greatest value ",*no1);
            else if(*no2>*no3)
                        printf("\n\n\t %d is greatest value ",*no2);
            else
                        printf("\n\n\t %d is greatest value ",*no3);
}
void main()
{
            int number1, number2, number3;
            clrscr();
            printf("Enter first number : ");
            scanf("%d",&number1);
            printf("Enter second number : ");
            scanf("%d",&number2);
            printf("Enter third number : ");
            scanf("%d",&number3);
            swap(&number1,&number2,&number3);
            getch();
}
6. Write a program to find sum and average of array using pointer.
#include<stdio.h>
#include<conio.h>
void main()
{
            int *p,arr[10],size,i;
            float average,sum=0;
            clrscr();
            printf("Enter size of array : ");
            scanf("%d",&size);

            for(i=0;i<size;i++)
            {
                        printf("arr[%d] : ",i);
                        scanf("%d",&arr[i]);
            }
            p = &arr[0];

            for(i=0;i<size;i++)
            {
                        sum =sum + *p;
                        p++;
            }
            printf("\n\nSum of elements : %.2f",sum);
            average = (float)(sum/size);
            printf("\n Average is = %.2f",average);
            getch();
}
Click Here to Download