Print upper triangular matrix using c program for given matix -

itstudentjunction

Print upper triangular matrix using c program for given matix

Upper triangular matrix:


A upper triangular matrix is a matrix where all entries above the principal diagonal are zero.




write a C program to find Upper triangle of a matrix


write a C program to print Upper triangle of a matrix / WAP for upper triangular matrix

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,r,c,a[10][10];
clrscr();
printf("To print upper traingle:");
printf("Enter the no of rows and no, of columns:");
scanf("%d%d",&r,&c);
for(i=1;i<=r;i++)
{
for(j=1;j<=c;j++)
{
printf("a[%d][%d]=",i,j);
scanf("%d",&a[i][j]);
}
}
printf("given matrix is");
for(i=1;i<=r;i++)
{
for(j=1;j<=c;j++)
{
printf("%d",a[i][j]);
}
printf("\n");
printf("The upper triangle is \n");
}
for(i=1;i<=r;i++)
{
printf("\n");
for(j=1;j<=c;j++)
{
if(i>=j) // main logic for upper triangle: row no, greater than or equal // to column no
{
printf("%d",a[i][j]);
}
else
{
printf("\t");
}
// printf("\n");
}
}
printf("\n\n");
for(i=1;i<=r;i++)
{
printf("\n");
for(j=1;j<=c;j++)
{
if(j>=i)
{
printf("%d",a[i][j]);
}
else
{
//printf("\t");
}
// printf("\n");
}
}
getch();
}

OUTPUT:

To print upper traingle:

Enter the no of rows and no, of columns: 2 2

a[1][1]= 1
a[1][2]= 0
a[2][1]= 6
a[2][2]= 3 given matrix is

1 0
6 3

The upper triangle is

1   0
     3

list of c programs

Most popular links:



To calculate CI BREADTH FIRST SEARCH USING POINTERS IN C compare strings strcmp write a C program for lower triangle To check even / odd write a C program for upper triangle of a matrix PRINT LIST ELEMENTS COMMON IN TWO LISTS TOPOLOGICAL SORT USING ARRAYS WAP to check print show prime factors MINIMAL SPANNING TREE USING PRIMS ALGORITHM IN Ccode for perfect number or not CIRCULAR LINKED LISTWAP to check print show amicable pair Write a C program to find upper triangle of a matrix KNAPSACK PROBLEM calculate average of n numbers WAP to find largest of n numbers SELECTION SORT USING ARRAYS IN C WAP for BINARY SEARCH USING ARRAYSwrite a C program to print upper triangle of a matrix calculate LCM of two numbers HEAP SORT USING POINTERSWAP to find upper triangular matrix write a program to find check print show numbers in word To implement print show pascal Triangle find roots BINARY SEARCH USING POINTERS IN C write a C program to check for palindrome string code for upper triangle of matrix WAP for QUEUE USING ARRAYS AVL TREE WAP to check calculate print show addition subtraction of complex numbers To check calculate show multiplication of complex numbers WAP to find check calculate print show numbers pyramid ADJACENCY LIST IN C write a C program to convert find check print show decimal to binary WAP to convert find check show decimal to octal write a C program to find upper triangle of a matrix QUEUE USING POINTERS write a program to find check calculate show sum of digits towers of hannoi To find check calculate print show palindrome number WAP for upper triangle of matrix DEPTH FIRST SEARCH WAP to find check calculate print show strong number or not WAP check biggest of three write a C program for upper triangle of matrix PRIORITY QUEUE largest & smallest values in arrayTo find check calculate print show no, of combinations WAP to find check calculate print show no, of permutations write a C program to print upper triangular matrix prime numbers wTo find check calculate print show power value write a program to find check calculate print show reverse number smallest number in arrayTo implement Floyd’s Triangle for n rows using for loop WAP to print upper triangle of matrix MULTIWAY TREE To find or check for even or odd WAP for swapping numbers write a C program to find upper triangular matrix MULTIPLE STACK calculation for addition two sparse matrix implementing function 1 write code to implement Floyd’s Triangle for n rows using while loop implementing function 2 write a C program to print upper triangle of matrixTo calculate or find check print show largest of two numbers implementing function 3 ADD two matrices multiply two matricessparse matrix SI using macros write a program to find for max min values WAP to find upper triangle of matrix find for gcd using recurrsionsum of factorial series find for reverse number sizes data types show automatic variable scope WAP show external variable scope show upper triangle of matrix static show variable scope WRITE C CODE FOR LINEAR SEARCH USING POINTERS show register variable scope employee data check for inverse of matrix find for reverse string strrev WAP for upper triangular matrix To convert find check print show decimal to hexadecimal find for reverse string pointers write a program to calculate or find check print show sum of Digits find for reverse string arrays BUBBLE SORT USING arrays write a C program to print upper triangle of matrixwrite a program to find check calculate print show no.of digits find for string length strlen find for string length pointerswrite a program to implement Floyd’s Triangle for 10 rows MERGE SORT USING ARRAYS concatinate strings strCat convert to lowercase write a C program to find upper triangle of a matrix convert to lowercase for first occurance of character count words count vowels compare two strings arrays QUEUE USING ARRAYS compare strings pointers WAP for upper triangle check for substring position LEAVES OF BINARY TREE fibonacci numbers write a C program to find check calculate print show sum of n numbers acromatic string rain drop character copy file student records in file write a C program for upper triangle of matrixline styles fill styles font styles escape operators write a C program to print upper triangle of a matrix B-TREE SPLAY TREE find for string length arrays RED BLACK TREE IN C HASHING CONCATENATE STRINGS DIJKSTRA'S ALGORITHM IN C MINIMAL SPANNING TREE USING KRUSKAL'S ALGORITHM LINEAR SEARCH USING ARRAYS IN C BUBBLE SORT USING ARRAYS C write a C program for upper triangular matrix convert to uppercase WRITE A PROGRAM FOR INSERTION SORT ARRAYS USING ARRAYS IN CHEAP SORT USING ARRAYS MATRIX MULTIPLICATION TRANSPOSE OF MATRIXwrite a C program to find upper triangle of a given matrix WRITE A C PROGRAM TO FIND CHECK OR SHOW SUBSTRING its POSITION STUDENT INFORMATION MULTIPLY SPARCE MATRICES WAP for upper triangle of a matrix COUNT STRINGS WAP for LINKED LIST USING POINTERS IN C REVERSE STRING PREFIX TO POSTFIX SINGLE LINKED LIST TO PRINT STRING IN LEXICOGRAPHIC ORDER write a C program for upper triangular matrix CONCATENATE LISTS SORT LIST To calculate check print show GCD of two numbers REVERSE LINKED LIST implementing function 3 SHOW POLYNOMIALwrite a C program to show upper triangle of a matrix ADD POLYNOMIALS STACK ARRAYS STACk USING POINTERS To check calculate print show armstrong number or notconcatinate strings arrays EXPRESSION TREE TRAVERSALSwrite a C program to check calculate show factors of numberwrite a C program for upper triangular matrix INFIX TO POSTFIX To check calculate print show sum of n numbers WAP for CIRCULAR QUEUE ARRAYS write a program to check calculate show factorial number string combinationsWrite a C program to find upper triangle of a given matrix COUNT NODES IN LINEAR LINKED LIST write a program to REVERSE A QUEUE using c BINARY TREE To implement CIRCULAR LINKED LIST write a program to check show prime number or not BINARY TREE TRAVERSALS WAP to print upper triangle WAP to check for transpose of matrix To find calculate print show SI check for first occurrence of substring write a C program to print upper triangular matrix check for last occurrence of substring multiply sparse matrix WAP to find for factorial using recurrsion write a C program to find for substring WAP to print upper triangle of a matrix C Programs Data structures Programs c Data structures Programs c++ Computer Graphics Programs Unix commands Linux commands HTML programming C++ programs,Data structures Algorithms, Java Programs UML Diagrams Assembly Language Programs DBMS j2ee programming c tutorials c++ tutorials java tutorials Data structures tutorials DBMS tutorials ignou mca assignments