Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #innclude <stdio.h>
- #include <stdlib.h>
- #include <conio.h>
- main() {
- int cont=0, vet[9], i, j, soma=0, media, maior=0, menor=0, rdivi=0;
- for(i=0; i<9; i++) {
- printf("Digite um numero");
- scanf("%d", &vet[i]);
- if(vet[i] %2==0) {
- rdivi +=vet[i];
- }
- soma += vet[i]; //soma dos n digitados
- media = soma / 9; //media
- cont++; //contador
- }
- for(j=0; j<9; j++) {
- if(j==0) {
- maior=vet[j];
- menor=vet[j];
- }
- else if(vet[j] > maior) {
- maior = vet[j];
- menor=menor;
- } else if
- (vet[j] < menor) {
- menor = vet[j];
- maior=maior;
- } else {
- maior=maior;
- menor=menor;
- }
- }
- printf("A soma e: %d \n \n", soma);
- printf("Foram digitados %d numeros \n \n", cont);
- printf("A media e: %d \n \n", media);
- printf("O maior numero digitado foi: %d \n \n", maior);
- printf("O menor numero digitado foi: %d \n \n", menor);
- printf("A soma dos pares e: %d \n \n", rdivi);
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement