-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexercicio7.c
40 lines (32 loc) · 850 Bytes
/
exercicio7.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//Bibliotecas
#include <stdio.h>
#include <locale.h>
int main()
{
// Regionalização (Desbuga palavras com acento)
setlocale(LC_ALL, "Portuguese_Brazil");
// Declaração das Variáveis
int vet[10];
int i;
for (i = 0; i < 10; i++)
{
printf("\nInforme o valor do elemento %d: ", i + 1);
scanf("%d", &vet[i]);
}
int maior = vet[0];
int posicaoMaior = 0;
printf("\n\n-=-=-=-=-=-=-=-=- Vetor -=-=-=-=-=-=-=-=-");
printf("\n %d ", vet[0]);
for (i = 1; i < 10; i++)
{
printf("- %d ", vet[i]);
if (vet[i] > maior)
{
maior = vet[i];
posicaoMaior = i;
}
}
printf("\n\n-=-=-=- Dados do Elemento -=-=-=-");
printf("\nMaior: %d | Posicao: %d | Indice: %d", maior, posicaoMaior + 1, posicaoMaior);
return 0;
}