Thursday, 28 June 2018

second largest of array

#include<stdio.h>
int main()
{
    int a[100],n,i,max,max2;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    scanf("%d",&a[i]);
    max=max2=a[0];
    for(i=0;i<n;i++)
    {
        if(a[i]>max)
        {
            max2=max;
          max=a[i];
         
      }
      else if(max2<a[i])
      {
          max2=a[i];
   
      }
  }
        printf("%d",max2);
      return 0;
  }

1 comment:

  1. Can you provide Python pandas hands on as well as some fresco play courses ans so that I can improve my T factor

    ReplyDelete

ASP.NET Core: How to implement Azure Active Directory (AAD) Authentication in ASP.NET Core

  In this tutorial, we will implement security for ASP.NET Core Application using Azure Active Directory (AAD).  In this tutorial, I will co...