In: Computer Science
#code:
#include <stdio.h>
int main()
{
int i,n,max;//declarations
printf("Please the number of elements(count)\n");//ask user to
enter the number of elements
scanf("%d", &n);//take the number from user
int a[n];//declaration of array with the size of 'n'
printf("Please enter the numbers\n");
for (i = 0; i < n; i++)
{
scanf("%d", &a[i]);
}
//finding the max
max=a[0];//initialize the first element as
maximum
for (i = 0; i < n; i++)
{
if (a[i] > max)//condition for checking the
maximum
{
max=a[i];
}
}
printf("maximum number is %d",max);//printing the maximum
}