Write a 'C' program to find the minimum of the eight floating point numbers and its place in the array.
#include <stdio.h>
#include <conio.h>
void main ( )
{
float arr[8], min;
int i, pos;
clrscr ( );
for ( i = 0; i < 8; i++ )
{
printf("\n\t\t Enter a number..:"); scanf("%f",&arr[i]);
}
min = arr[0];
pos = 0;
for ( i = 1; i < 8; i++ )
{
if ( arr[i] < min )
{
min =arr[i];
pos = i;
}
}
printf("\n\n\n\t The minimum number is %f and it is in the %d index of the array.",min,pos);
getch ( );
}
Click here to contact us
#include <stdio.h>
#include <conio.h>
void main ( )
{
float arr[8], min;
int i, pos;
clrscr ( );
for ( i = 0; i < 8; i++ )
{
printf("\n\t\t Enter a number..:"); scanf("%f",&arr[i]);
}
min = arr[0];
pos = 0;
for ( i = 1; i < 8; i++ )
{
if ( arr[i] < min )
{
min =arr[i];
pos = i;
}
}
printf("\n\n\n\t The minimum number is %f and it is in the %d index of the array.",min,pos);
getch ( );
}
Click here to contact us
No comments:
Post a Comment