-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathQ3.c
More file actions
29 lines (29 loc) · 638 Bytes
/
Q3.c
File metadata and controls
29 lines (29 loc) · 638 Bytes
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
/* Program:- 3
Write a 'C' Program to accept 'n' numbers from user, store these numbers into an array.
Find out Largest and Smallest number from an array.
*/
#include <stdio.h>
void main()
{
int n, i, max, j, min;
printf("What number do you want to enter: ");
scanf("%d", &n);
int num[n];
printf("Enter the %d integer number\n", n);
for (i = 0; i < n; i++)
scanf("%d", &num[i]);
max = num[0];
min = num[0];
for (j = 0; j < n; j++)
{
if (max < num[j])
{
max = num[j];
}
if (min > num[j])
{
min = num[j];
}
}
printf("max= %d\nmin= %d", max, min);
}