Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int val,sum = 0,quant = 0;
- float med;
- do
- {
- printf("Entre com um numero inteiro positivo :\n");
- scanf("%d",&val);
- if(val>=0)
- {
- quant++;
- sum = sum + val;
- }
- }while(val>=0);
- med = (float)sum/(float)quant;
- printf("A media dos numeros inseridos eh : %f\n",med);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment