Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void){
- int qualifier, count=0;
- long int inp_number, min, max;
- float average;
- qualifier = scanf("%ld", &inp_number);
- if (qualifier == 1){
- average = inp_number;
- for (min = max = inp_number; qualifier == 1; count ++){
- if (inp_number > max){
- max = inp_number;
- }
- else if (inp_number < min){
- min = inp_number;
- }
- average = (average/(count+1))*count + inp_number/(count+1);
- qualifier = scanf("%ld", &inp_number);
- }
- printf("average is ");
- printf("%f\n", average);
- printf("max is ");
- printf("%ld\n", max);
- printf("min is ");
- printf("%ld\n", min);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement