Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Thiago Guimarães Almeida - 1411472
- #include <stdio.h>
- void soma_sub_um (int * vet, int tam)
- {
- int i;
- for (i=0; i<tam;i++)
- {
- if (i%2==0)
- *(vet+i)=*(vet+i)+1;
- else
- *(vet+i)=*(vet+i)-1;
- }
- }
- int main (void)
- {
- int n[1234],dim,i;
- printf("Digite a dimensao do vetor de inteiros");
- scanf("%d", &dim);
- for (i=0;i<dim;i++)
- {
- printf("Digite o valor do %d numero do vetor",i+1);
- scanf("%d",&n[i]);
- }
- soma_sub_um(n, dim);
- for (i=0;i<dim;i++)
- printf("%d\n",n[i]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement