-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy path36.c
More file actions
42 lines (41 loc) · 872 Bytes
/
36.c
File metadata and controls
42 lines (41 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//Program to print the upper triangle and lower triangle of a matrix
#include<stdio.h>
void main()
{
int n;
printf("\nEnter order of the square matrix :");
scanf("%d",&n);
int A[n][n];
printf("\nENTER MATRIX A VALUES\n");
for(int I=0;I<n;I++)
{
for(int J=0;J<n;J++)
{
scanf("%d",&A[I][J]);
}
}
printf("LOWER MATRIX C VALUES ARE :\n");
for(int I=0;I<n;I++)
{
printf("\n");
for(int J=0;J<=I;J++)
{
printf("%d\t",A[I][J]);
}
printf("\n");
}
printf("UPPER MATRIX C VALUES ARE :\n");
for(int I=0;I<n;I++)
{
printf("\n");
for(int J=0;J<n;J++)
{
if(J>=I)
printf("%d\t",A[I][J]);
else
printf("\t");
}
printf("\n");
}
printf("\n");
}