-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnew.c
45 lines (45 loc) · 1.07 KB
/
new.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <stdio.h>
int main()
{
int n;
printf("Enter the length of the array:");
scanf("%d", &n);
int arr[n];
printf("Enter the elements of the array:\n");
for (int i = 0; i < n; i++)
{
scanf("%d", &arr[i]);
}
int p = arr[0];
printf("Choose any one of the following:\n1. Maximum element of the array\n2. Minimum element of the array\n");
int choice;
scanf("%d",&choice);
if (choice == 1)
{
for (int i = 0; i < n; i++)
{
// scanf("%d",&arr[i]);
if (arr[0]<arr[i])
{
/* code */
p=arr[i];
}
}
printf("The maximum element of the array is: %d\n",p);
}
if (choice == 2)
{
for (int i = 0; i < n; i++)
{
// scanf("%d",&arr[i]);
if (arr[0]>arr[i])
{
/* code */
p=arr[i];
}
}
printf("The minimum element of the array is: %d\n",p);
}
printf("in dev branch\n");
printf("New change in dev branch");
}