This web page requires JavaScript to be enabled.

JavaScript is an object-oriented computer programming language commonly used to create interactive effects within web browsers.

How to enable JavaScript?

Kiểm tra mảng nhập vào là dãy tăng dần hay giảm dần

10cth1-2 January 24, 2011 0
#include <conio.h>
#include <stdio.h>

int main()
{
  int A[100],i,n,flag=1;
  printf("\n Nhap n=");
  scanf("%d",&n);
  printf("\n Nhap mang: \n");
  for(i=0;i<n;i++)
    {
      printf("A[%d]=",i);
      scanf("%d",&A[i]);
    }
  for(i=0;i<n-1;i++)
    {
      if(A[i+1]<A[i])
        {
          flag=0;
          printf("\n Day ko la day tang dan, phan tu ko tang dau tien la: %d \n",A[i+1]);
          break;
        }
    }
  if(flag==1)
    printf("\n Day la day tang dan \n");
getch();
}

Last modified on December 22nd, 2021 at 12:39 am

Nam Le
lequocnam



0 responds

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.