Skip to content

Instantly share code, notes, and snippets.

@echo-akash
Created August 4, 2017 17:32
Show Gist options
  • Save echo-akash/25e3b75f1aca56f36a3634735aa05a32 to your computer and use it in GitHub Desktop.
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.
#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