Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main( int argc , char** argv )
- {
- int n = 1;
- int i;
- double tomb[ n ];
- int min = 0 , max = 0;
- scanf( "%d" , &n );
- for( i = 0; i < n; i++)
- {
- scanf( "%lf" , &tomb[ i ] );
- }
- //Minimumkeresés
- for( i = 0; i < n; i++ )
- {
- if( tomb[ i ] < tomb[ min ] )
- {
- min = i;
- }
- }
- printf( "A legkisebb elem: %lf\n" , tomb[ min ] );
- //Maximumkeresés
- for( i = 0; i < n; i++ )
- {
- if( tomb[ i ] > tomb[ max ] )
- {
- max = i;
- }
- }
- printf( "A legnagyobb elem: %lf\n" , tomb[ max ] );
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment