ok i missed a day of school and the book they gave us for class is sooo confusing so can you help me?
i got to write a program that has N number of inputs
i take those inputs and find the sum average, smallest, and largest.
well i got the smallest and average part dont i cant figure out how to do the largest though this stuff is sooooo hard.
heres what i got so far
#include <stdio.h>
int main()
{
float smallest, largest, average, num, sum=0;
int N, i;
printf("enter the number of inputs >");
scanf("%d",&N);
for(i=0; i < N;i++)
{
printf("enter number > ");
scanf("%f", &num);
sum = sum + num;
if(i== 0)
smallest = num;
if(smallest > num)
smallest = num;
}
average = sum/N;
printf("the average = %f\n", average);
printf("the smallest = %.2f\n", smallest);
// printf("the largest = %f.2\n", largest);
return 0;
}
i got to write a program that has N number of inputs
i take those inputs and find the sum average, smallest, and largest.
well i got the smallest and average part dont i cant figure out how to do the largest though this stuff is sooooo hard.
heres what i got so far
#include <stdio.h>
int main()
{
float smallest, largest, average, num, sum=0;
int N, i;
printf("enter the number of inputs >");
scanf("%d",&N);
for(i=0; i < N;i++)
{
printf("enter number > ");
scanf("%f", &num);
sum = sum + num;
if(i== 0)
smallest = num;
if(smallest > num)
smallest = num;
}
average = sum/N;
printf("the average = %f\n", average);
printf("the smallest = %.2f\n", smallest);
// printf("the largest = %f.2\n", largest);
return 0;
}