Commit 3f38bf38 by ilahma

Upload New File

parent d2d7b35d
Showing with 52 additions and 0 deletions
#include <stdio.h>
int main ()
{
int a[10];
int i = 0;
int ascendingCount=0;
int descendingCount=0;
printf("Enter the element of array:\n");
for(i=0; i<10; i++)
{
scanf("%d",&a[i]);
}
for(i=0; i<10; i++)
{
printf("%d\n",a[i]);
}
int num1=a[0];
for(i=1;i<10;i++)
{
if(a[i]>=num1)
{
num1=a[i];
ascendingCount++;
}
else if(a[i]<=num1)
{
num1=a[i];
descendingCount++;
}
}
if(ascendingCount==9)
{
printf("ASCENDING");
}
else if(descendingCount==9)
{
printf("it is descending");
}
else
{
printf("NONE");
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment