Order of the matrix, Data Structure & Algorithms

/* The program accepts matrix like input & prints the 3-tuple representation of it*/

#include

void main()

{

int a[5][5],rows,columns,i,j;

printf("enter the order of the matrix. The order must be less than 5 × 5:\n");

scanf("%d %d",&rows,&columns);

printf("Enter elements of the matrix:\n");

for(i=0;i

for(j=0;j

{

 scanf("%d",&a[i][j]);

}

printf("The 3-tuple representation of  any matrix is:\n");

for(i=0;i

for(j=0;j

{

if (a[i][j]!=0)

{

}

Output:

printf("%d    %d       %d\n", (i+1),(j+1),a[i][j]);

}

}

Enter the order of the matrix. The order must be less than 5 × 5:

3 3

Enter the elements of the matrix:

1 2 3

0 1 0

0 0 4

The 3-tuple representation of the matrix is:

1

1

1

1

2

2

1

3

3

2

2

1

3

3

4

Initially the program prompted for the order of the input matrix along a warning that the order must not be greater than 5 × 5. After accepting order, this prompts for the elements of the matrix. After accepting the matrix, this checks each element of the matrix for a non zero. If the element is non zero, then this prints the row number & column number of that element along its value.

Posted Date: 4/4/2013 6:35:20 AM | Location : United States







Related Discussions:- Order of the matrix, Assignment Help, Ask Question on Order of the matrix, Get Answer, Expert's Help, Order of the matrix Discussions

Write discussion on Order of the matrix
Your posts are moderated
Related Questions
Explain the term - Branching There are two common ways of branching: case of ..... otherwise ...... endcase  if ..... then ..... else ..... endif   case of

Explain th term input and output-  Pseudocode Input and output indicated by the use of terms input number, print total, output total, print "result is" x and so on.

Part1: Deque and Bag Implementation First, complete the Linked List Implementation of the Deque (as in Worksheet 19) and Bag ADTs (Worksheet 22). Files Needed: linkedList.c Linke

Q. What do you mean by the best case complexity of quick sort and outline why it is so. How would its worst case behaviour arise?

What do you understand by term structured programming? Explain the structured programming as well.                                 Ans. S tructured Programming is expla

how to write a code for for a company , for calculate the salary pay

Q. Suggest a method of implementing two stacks in one array such that as long as space is there in an array, you should be capable to add an element in either stack. Using proposed

Explain the Scan-Line Algorithm This image-space method for removing hidden surfaces is an extension of the scan-line algorithm for filling polygon interiors. Instead of fillin


Q. Perform implementation of a queue using a singly linked list L. The operations INSER and DELETE should take O (1) time.