Friday 7 September 2012

Array028

Input five numbers in an array. Write a program to find the maximum value in that array.

#include <stdio.h>
#include <conio.h>

void main ( )
{
             int        co, no[5], max;
             clrscr ( );
                           
             for ( co = 0; co < 5; co++ )
             {                                          
                                printf ("\n\t\t\t Enter a number...........:"); scanf ("%d", &no[co]);
             }                                            
                                                   
             max = no[0];
             for ( co = 0; co < 5; co++ )
             {                                          
                                if ( max < no[co] )
                                {                                 
                                              max = no[co];
                                }
             }
             printf("\n\n\n\t\t\t The Maximum value is = %d", max );
             getch ( );
}

Click here to contact us

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...