0
c program to find the largest number in an array using function
5 Respostas
+ 2
no its my own
0
#include <stdio.h>
int main()
{
int i, n;
int arr[100];
printf("Enter the number of elements (1 to 100): ");
scanf("%d", &n);
for (i = 0; i < n; ++i)
{
printf("Enter number%d: ", i + 1);
scanf("%d", &arr[i]);
}
// storing the largest number to arr[0]
for (i = 1; i < n; ++i)
{
if (arr[0] < arr[i]) arr[0] = arr[i];
}
printf("Largest element = %d", arr[0]);
return 0;
}
0
This is not using function