#include <stdio.h>
int main()
{
int i, n, largestNumber;
float arr[100];
printf("Enter total number of elements(1 to 100): ");
scanf("%d", &n);
printf("\n");
// Stores number entered by the user
for(i = 0; i < n; ++i) {
printf("Enter Number %d: ", i+1);
scanf("%f", &arr[i]);
if(largestNumber < arr[i]) {
largestNumber = arr[i];
}
}
printf("The entered numbers are: ");
for(i = 0; i < n; ++i) {
printf("%d ", arr[i]);
}
printf("Largest element = %.2f", largestNumber);
return 0;
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.