Created
October 27, 2022 13:20
-
-
Save faisal95bd/98753c6a362ac4a7717314d6bb6edf08 to your computer and use it in GitHub Desktop.
2 - array_largest_number.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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