Skip to content

Commit 84a0fa0

Browse files
committed
Ds algo
1 parent 53bdf92 commit 84a0fa0

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

Arrays/FindingIncreasingSubArray.c

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#include <stdio.h>
2+
3+
int IncreasingArray(int arr[], int n)
4+
{
5+
6+
int count = 0;
7+
for (int i = 0; i < n; i++)
8+
9+
{
10+
for (int j = i + 1; j < n; j++)
11+
12+
{
13+
if (arr[j] > arr[j - 1])
14+
{
15+
count++;
16+
}
17+
18+
else
19+
{
20+
break;
21+
}
22+
}
23+
}
24+
return count;
25+
}
26+
27+
int main()
28+
{
29+
30+
int arr[] = {1, 2, 3, 4, 5, 6, 1, 8, 9};
31+
int size = sizeof(arr) / sizeof(arr[0]);
32+
int result = IncreasingArray(arr, size);
33+
printf("The count of the increasing sub arrays are %d", result);
34+
35+
return 0;
36+
}

Arrays/FindingIncreasingSubArray.exe

47.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)