#include<stdio.h>
int main(){
float arr[28];
int i;
printf("Enter prices:\n");
for(i=0; i<28; i++){
printf("Prices: %d\n",(i+1));
scanf("%f",&arr[i]);
}
float sum = 0;
int n;
printf("All prices less than 5 downward:\n");
for(n=0; n<28; n++){
sum +=arr[n];
if(arr[n]<5){
printf("%f ", arr[n]);
}
else{
printf(" ");
}
printf("\n");
}
printf("The sum of all the prices: %f\n", sum);
float average = sum /28;
printf("The average of all the prices: %f\n", average);
printf("All values that are higher than the calculated average");
int k=0;
for(k=0; k<28;k++){
if(arr[k]>average){
printf("%f ", arr[k]);
}
else{
printf(" ");
}
}
}
Comments
Thanks
Leave a comment