Introduction

The main purpose of this blog is to share our experience with the world and get experience from the world. This will be a new venture for us and we are sure, we shall learn a lot with it. we will try to Explore our mind which will be very helpful for all us. As from its name, its a blog covering all the topics. we will try to post all the interesting topics and give our opinion. Do give your point of view in comments.


"NAVIGATE VIA BLOG ARCHIVE ON RIGHT TO GET WHAT YOU ARE LOOKING FOR"


Sunday, February 6, 2011

C Code for Finding maximum entry in data

#include<stdio.h>
void array(int a[4][3]);
int locater(int b[4][3],int c);
int main()
{
    int marks,i;
    int record[4][3]={{12,25,67},{32,30,65},{15,34,70},{20,40,79}};
    printf("\n\n\n");
    array(record);
    for(i=0;i<3;i++)
        {
            marks=locater(record,i);
            if(i==0)
            {
            printf("\nThe Maximum lowest marks in all sections are %d\n",marks);
            }
            if(i==1)
            {
            printf("The Maximum Average in all sections are %d\n",marks);
            }
            if(i==2)
            {
            printf("The Maximum Highest marks in all sections are %d\n\n\n\n",marks);
            }
        }
    return 0;
}
void array(int a[4][3])
{
            int i,j;
            printf("Sections    Lowest Average Highest\n");
            printf("        marks  marks    marks\n"   );
                for(i=0;i<4;i++)
                    {   
                    printf("Section %d\t",i+1);
                    for(j=0;j<3;j++)
                        {
                            printf("%d\t",a[i][j]);
                        }   
                    printf("\n");
                    }
}
int locater(int a[4][3],int c)
{
            int x;
            for(x=0;x<4;x++)
            {
                if(a[x][c]>=a[1][c] && a[x][c]>=a[2][c] && a[x][c]>=a[3][c])
                               {   
                return a[x][c];       
                            }   
            }
}

No comments:

Post a Comment

Related Posts with Thumbnails