Created
August 4, 2017 17:32
-
-
Save echo-akash/25e3b75f1aca56f36a3634735aa05a32 to your computer and use it in GitHub Desktop.
Input an array of integers and print the maximum number among them.
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 ar1[100]; | |
int i,max,n; | |
printf("enter number of elements of array:"); | |
scanf("%d",&n); | |
printf("enter the numbers:"); | |
for(i=0;i<n;i++) | |
{ | |
scanf("%d",&ar1[i]); | |
} | |
max=ar1[0]; | |
for(i=0;i<n;i++) | |
{ | |
if(max<ar1[i]) | |
max=ar1[i]; | |
} | |
printf("the maximum number is:%d",max); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment