Friday, 22 June 2018

Program to find maximum of 5 element of an array in C using for loop statement

/* program of maximum */
# include <stdio.h>
void main ()
{
int a[5],i,max=0 ;
clrscr () ;
for ( i=0 ; i<5 ; i++ )
{
printf ( "\n Enter a number:") ;
scanf ("%d", & a[i]) ;
}
for ( i=0 ; i<5 ; i++)
{
if ( max < a[i] )
max = a[i] ;
}
printf ("\n max = %d", max) ;
getch () ;
}

No comments:

Post a Comment

Featured post

Program to find Volume of given box in java

class volume { public static void main (String args []) { int l=5,b=6,h=10; int volume; volume=l*b*h; System.out.println (" vol...