Sunday, 27 November 2011

Program For Find Second Max Value In Array In Ds


#include<stdio.h>
#include<conio.h>
void main()
{
  int a[5],i,m=0,sm=0;
  clrscr();
  for(i=0;i<5;i++)
   {
     printf("enter value in array");
scanf("%d",&a[i]);
   }
  for(i=0;i<5;i++)
   {
     if(a[i]>m)
 {
   sm = m;
m = a[i];
 }
if(a[i]>sm)
 sm > a[i];
   }
  printf("second max value=%d",sm);
  getch();

}
  

No comments:

Post a Comment