C Program to represent sparse matrix write code

itstudentjunction

C Program to represent sparse matrix write code


sparse matrix

A sparse matrix is a matrix in which most of the elements are zero. If storage space is more important than access speed, it may be preferable to store a sparse matrix as a list of (index, value) pairs



write a C program to implement sparse matrix


write a C program to represent sparse matrix / Implement sparse matrix using c language

#include<stdio.h>
void main()
{
int a[10][10];
int row,col,k,l,ch;
char che;
clrscr();
printf("enter the no. of rows\t:");
scanf("%d",&row);
printf("\n enter the no. of columns\t:");
scanf("%d",&col);
printf("\n enter the elements of sparse matrix \t:");
for(k=0;k<row;k++)
{
for(l=0;l<col;l++)
{
printf("\n element at [%d][%d]\t",k,l);
scanf("%d",&a[k][l]);
}
}
printf("sparse matrix is \n");
for(k=0;k<row;k++)
{
for(l=0;l<col;l++)
{
if (a[k][l] ==0)
{
printf("%d\t%d\t%d\n",k, l, a[k][l]);
}
}
printf("\n");
}




list of c programs




Most popular programs

write a program to find factorial using c
WAP to Calculate Simple Interest
Check for even / odd
perfect or not
sum of two matrices
show amicable pairs
factors of a number using for loop, while
print prime factors using C
convert to uppercase
write a C program to represent sparse matrix
write a program for prime numbers using for loop
write a program to implement pascal Triangle
check reverse string arrays
find string length strlen
Calculate compound Interest
check armstrong number or not
print prime numbers using while
solve towers of hanoi
implement Floyd’s Triangle
reverse string using pointers
write a program to find a number is prime or not
Show revers number
calculate LCM concatinate strings using arrays
write a program to find palindrome or not
WAP to print sum of Digits
represent transpose of matrix
implement lower triangle
multipiy two matrices
write a program to calculate GCD
strong number or not
check substring in c
string length using arrays
string length using pointers
convert to lowercase
WAP to find factors
count no.of digits
show inverse of matrix
show reverse string strrev
write a program to display upper triangle
concatinate strings strCat
convert to lowercase
check for palindrome string
print substring position
compare two strings arrays
compare strings strcmp
find roots of quadriaic expression
show fibonacci numbers
factorial using recurrsion
sum of factorial series
convert decimal to binary
Write a program to print armstrong numbers

write a C program to implement sparse matrix
decimal to octal
compare strings pointers
represent decimal to hexadecimal
sum of n numbers
average of n
largest of two
largest of n

pyramid of numbers
strong numbers
perfect numbers using for loop




C Programs Data structures Programs in c Data structures Progra+ms in c++ Unix commands Linux commands C++ programs Data structures Algorithms Java Programs UML Diagrams Assembly Language Programs DBMS j2ee programming