Ascending Order in C Programming

Image result for c programming

 Ascending Order in C Programming

Code:
  #include<stdio.h>
int main(){
  int n,i,a[15],flag=1;
  scanf("%d",&n);
  for(i=0;i<n;i++)
  {
    scanf("%d",&a[i]);
  if(i>0)
  {
    if(!(a[i-1]<a[i]))
      flag=0;
  }
  }
  if (flag)
    printf("yes");
  else
    printf("no");
  return 0;
}

No comments