-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMinimum_Integer.c
51 lines (48 loc) · 1018 Bytes
/
Minimum_Integer.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
46
47
48
49
50
51
#include <stdio.h>
void sort(int arr[],int N){
int temp;
for (int i = 0; i < N; i++)
{
for (int j = 0; j < N; j++)
{
if (arr[j]>arr[j+1])
{
temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}
}
}
}
int Min_int(int arr[],int N){
int sum=0;
for (int i = 0; i < N; i++)
{
sum+=arr[i];
}
for (int i = 0; i < N; i++)
{
if (sum<=(arr[i]*N))
{
return arr[i];
}
}
}
int main()
{
int arr[] = {1,3,2};
int N = 3;
for (int i = 0; i < N; i++)
{
printf("%d ",arr[i]);
}
sort(arr,N);
printf("\nAfter sorting.....\n");
for (int i = 0; i < N; i++)
{
printf("%d ",arr[i]);
}
printf("\nThe Min int is = ");
printf("%d ",Min_int(arr,N));
return 0;
}