Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* CABEÇALHO
- Arquivo: LISTA 03 - Exercicio 13.c
- Objetivo: Calcula a media de varios numeros.
- Autor(a): Ramon Borges
- */
- #include <stdio.h>
- int main()
- {
- int num = 0, soma = 0, cont = 0, media;
- while(num >= 0)
- {
- printf("\nInforme um numero: ");
- scanf("%f", &num);
- if(num >= 0)
- {
- soma += num;
- cont++;
- }
- }
- media = soma / cont;
- printf("\nMedia = %f \n", media);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment