Advertisement
Guest User

Untitled

a guest
Sep 11th, 2014
688
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.         int i,max=0,temp=0;
  5.         int a[] = {23,43,53,12,66,23,55,99,23,67,3};
  6.         for(i=0;i<=10;i++)
  7.         {
  8.                 if(a[i]>max)
  9.                 {
  10.                         temp = max;
  11.                         max = a[i];
  12.                 }
  13.                 else
  14.                 {
  15.                         if(temp < a[i])
  16.                                 temp = a[i];
  17.                 }
  18.         }
  19.         printf("Second largest element is %d",temp);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement