Skip to content

Instantly share code, notes, and snippets.

@faisal95bd
Created October 27, 2022 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save faisal95bd/98753c6a362ac4a7717314d6bb6edf08 to your computer and use it in GitHub Desktop.
Save faisal95bd/98753c6a362ac4a7717314d6bb6edf08 to your computer and use it in GitHub Desktop.
2 - array_largest_number.c
#include <stdio.h>
int main() {
int arr[30], i;
printf("Enter the thirty numbers\n\n");
for (int i = 0; i < 30; ++i) {
printf("Enter number%d: ", i + 1);
scanf("%d", &arr[i]);
}
for (int i = 1; i < 30; ++i) {
if (arr[0] < arr[i]) {
arr[0] = arr[i];
}
}
printf("\nThe largest number is: %d \n", arr[0]);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment