1#include <stdio.h>
2int main() {
3 int i, n;
4 float arr[100];
5 printf("Enter the number of elements (1 to 100): ");
6 scanf("%d", &n);
7
8 for (i = 0; i < n; ++i) {
9 printf("Enter number%d: ", i + 1);
10 scanf("%f", &arr[i]);
11 }
12
13 // storing the largest number to arr[0]
14 for (i = 1; i < n; ++i) {
15 if (arr[0] < arr[i])
16 arr[0] = arr[i];
17 }
18
19 printf("Largest element = %.2f", arr[0]);
20
21 return 0;
22}
23
1// For defining x > y
2#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
3// For defining x < y
4#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
1#include <stdio.h>
2#include <stdlib.h>
3
4int main()
5{
6 double num1,num2,maxNum,minNum;
7
8 printf("Enter a number: ");
9 scanf("%lf", &num1);
10 printf("Enter another number: ");
11 scanf("%lf", &num2);
12 printf("\n");
13
14 if (num1 > num2){
15 maxNum = num1;
16 minNum = num2;
17
18 printf("The largest number is %f \n",maxNum);
19 printf("The smallest number is %f \n",minNum);
20 }else if (num1 < num2){
21 maxNum = num2;
22 minNum = num1;
23
24 printf("The largest number is %f \n",maxNum);
25 printf("The smallest number is %f \n",minNum);
26 }printf("The numbers are equal");
27
28 return 0;
29}