Preencher um vetor de 8 elementos inteiros. Mostrar o vetor e informar quantos números são maior que 30, Somar estes números. Somar todos os números. English Fill a vector of 8 elements integers. Show the vector and report how many numbers are greater than 30, Sum these numbers. Add up all the numbers.
#include stdio.h
#include conio.h
main ()
{
int vetor[3],cont,cont2=0;
float soma=0,soma2=0;
for(cont=0;cont<3;cont++)
{
printf("Digite os numeros: ");
scanf("%d",&vetor[cont]);
}
printf("\n\nVetor formado :\n");
for(cont=0;cont<3;cont++)
{
soma2+=vetor[cont];
printf("%d = [%d] \n",cont,vetor[cont]);
if (vetor[cont]>30)
{
soma+=vetor[cont];
cont2++;
}
}
printf("\nSoma Vetores >30 = %.0f\nSoma todos vetores = %.0f",soma,soma2);
getch();
}






1 comentários:
Valeu !!!!! Ajudou pra caramba !!!
Postar um comentário