View difference between Paste ID: uNMuPEBT and h41bNfcD
SHOW: | | - or go back to the newest paste.
1
#include    <stdio.h>
2
#include    <stdlib.h>
3
4
int MatrizIdentidade(int nxn)
5
{
6
    if(nxn <= 0)
7-
        return printf("Número de linhas (colunas) inválido.");
7+
        return printf("Numero de linhas (colunas) invalido.\n\n\n");
8
9
    for(int i = 1; i <= nxn; ++i)
10
        for(int j = 1; j <= nxn; ++j)
11
            printf("%d%s", i == j, j == nxn ? ("\n") : (""));
12
13
    return 1;
14
}
15
16
main()
17
{
18-
    MatrizIdentidade(3);
18+
    int
19-
    system("PAUSE");
19+
        npn = 1;
20
    ;
21
    
22
    while(npn > 0)
23
    {
24
        printf("Digite o numero de linhas (colunas) da matriz (use 0 para fechar o programa): ");
25
        scanf("%d", &npn);
26
        MatrizIdentidade(npn);
27
        system("PAUSE");
28
        system("CLS");
29
    }
30
}