Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how to generate sparse matrix in c

Answer Posted / it career point

//program to 3-tuple representation
#include<stdio.>
#include<conio.h>
void main()
{
int a[5][5],row,columns,i,j;
printf(Ënter the order of the matrix.(5*5)");
scanf("%d%d",&row,&columns);
printf("Enter the element of the matrix\n");
for(i=0;i<row;i++)
for(j=0;j<columns;j++)
{
scanf("%d", &a[i][j]);
}
printf("3-tuple representation");
for(i=0;i<row;i++)
for(j=0;j<column;j++)
{
if(a[i][j]!=0)
{
printf("%d %d %d", (i+1),(j+1),a[i][j]);
}
}

getch();
}

Is This Answer Correct ?    41 Yes 42 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the difference between #include "..." And #include <...> In c?

1088


how to execute a program using if else condition and the output should enter number and the number is odd only...

2368


How to Throw some light on the splay trees?

1101


How to write c functions that modify head pointer of a linked list?

1030


Explain what is a stream?

1142


Why do we use header files in c?

1123


What does sizeof int return?

1132


What are the types of data types and explain?

1130


Explain what are binary trees?

1128


What are the ways to a null pointer can use in c programming language?

1193


I have seen function declarations that look like this

1091


Write a C program to count the number of email on text

1965


What are the uses of null pointers?

1193


Do you know the purpose of 'register' keyword?

1065


What are c identifiers?

1151