Created
December 15, 2016 14:19
-
-
Save jeffotoni/b3df115996909835396428eebf04606b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @abstract: Exemplo usando media | |
* @name: @jeffotoni | |
* | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
int main () { | |
int *v, n, i; | |
float soma,media=0.0, float2 = 34589.8238; | |
puts(""); | |
printf("\nQual o tamanho do vetor que deseja: "); | |
scanf("%d", &n); | |
v = (int *) malloc( n * sizeof(int)); | |
for (i = 0; i < n; i++) { | |
printf("Informe o %dº elemento: ", i+1); | |
scanf("%d", &v[i]); | |
soma += v[i]; | |
} | |
media = (soma / n); | |
printf("\nTeste %0.04f", float2); | |
printf("\n Media: %2.2f ", media); | |
puts(""); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment