Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- /*
- * Preencher uma matriz 3x3 e imprimir
- */
- int main( void )
- {
- // Cria as variaveis usadas
- int matriz[3][3];
- int linhas, colunas;
- // Preenche a matriz pelo teclado
- for( linhas=0; linhas<3; linhas++ )
- {
- for( colunas=0; colunas<3; colunas++ )
- {
- printf("Elemento [%d][%d]: ", linhas, colunas);
- scanf("%d", &matriz[linhas][colunas]);
- }
- }
- // Exibe a matriz
- printf("\n");
- for( linhas=0; linhas<3; linhas++ )
- {
- for( colunas=0; colunas<3; colunas++ )
- printf("%d ", matriz[linhas][colunas]);
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement