Created
May 10, 2012 15:04
-
-
Save ciceroverneck/2653738 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
void MultiplicaEscalar(float *vet, int escalar){ | |
int i; | |
for(i=0;i<5;i++){ | |
printf("%f * %d = %f\n", vet[i], escalar, vet[i] * escalar); | |
vet[i] = vet[i] * escalar; | |
} | |
} | |
int main(){ | |
float vetor[5]; | |
int i, esc; | |
for(i=0;i<5;i++){ | |
printf("Entre com valor para o vetor:\n"); | |
scanf("%f", &vetor[i]); | |
} | |
printf("Entre com um escalar a ser multiplicado pelo vetor:\n"); | |
scanf( "%d", &esc ); | |
MultiplicaEscalar( &*vetor, esc); | |
for(i=0;i<5;i++){ | |
printf("%f\n", vetor[i]); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment