Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- int main()
- {
- float a;
- float b = 0;
- float avr =1;
- float amount = 0;
- printf("enter the number: ");
- scanf ("%f", &a);
- while(a != 0 )
- {
- if( fabs(a)<100)
- amount++;
- if (a > 0)
- {
- avr = ((avr * b )+ a)/(b+1);
- b++;
- }
- printf("enter the number: ");
- scanf ("%f", &a);
- }
- printf( "Average is equal = %f and the number of numbers les than 100 = %f", avr,amount);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement