Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- int num=0,resp=0,cont=0;
- float media=0,suma=0;
- printf("Desea ingresar un numero SI(1) - NO(0)");
- scanf("%d", &resp);
- while (resp==1){
- printf ("Ingrese un numero para sumar \n");
- scanf ("%i", &num);
- suma+=suma+num;
- cont++;
- printf ("Desea ingresar otro numero SI(1) NO(0)");
- scanf ("%i", &resp);
- }
- media=suma/cont;
- printf("La media es: %f\n", media);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement