how can i write a program that can read a list of integers and then print the largest and the smallest values? thanks!
here's my work.
float low, high, in;
fin = fopen("infile.dat", "r");
fout = fopen("infile.dat", "w");
while (fscanf( fin, "%d", &in) !=EOF )
if (in < low)
low = in;
if (in > high)
high = in;
printf( "Smallest number is:\n%f\n", low);
printf("Largest number is: \n%d\n", high);