Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //IFF - Introdução à Programação
- //Slide - Página 60 - Exercício 2
- #include<stdio.h>
- #include<locale.h>
- int Soma(int vetor[], int matriz[][5]){
- for(int l=0;l<3;l++){
- for(int c=0;c<5;c++){
- vetor[l]+=matriz[l][c];
- }
- }
- for(int l=0;l<3;l++) printf("Soma dos valores da coluna %d: %d.\n",l+1,vetor[l]);
- }
- int main(){
- setlocale(LC_ALL,"Portuguese");
- int vetor[3]={0,0,0}, matriz[3][5];
- for(int l=0;l<3;l++){
- for(int c=0;c<5;c++){
- printf("Entre com o valor (%d,%d): ",l+1,c+1);
- scanf(" %d",&matriz[l][c]);
- }
- }
- Soma(vetor, matriz);
- }
Advertisement
Add Comment
Please, Sign In to add comment