answersLogoWhite

0


Best Answer

Here is the C program to check whether the inputted matrix is scalar matrix or not. ( its not my creation, its get from other website,am not check)

#include<stdio.h>

#include<conio.h>

int main()

{

int a[10][10],i,j,m,n,f=0;

printf("Enter the order of the matrix\n");

scanf("%d%d",&m,&n);

printf("Enter the matrix\n");

for(i=0;i<m;i++)

{

for(j=0;j<n;j++)

{

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

}

}

if(m!=n)

{

printf("The matrix is not identity");

}

else

{

for(i=0;i<m;i++)

{

for(j=0;j<n;j++)

{

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

{

printf("The matrix is not scalar\n");

f=1;

break;

}

}

if(f==1)

{

break;

}

}

if(f==0)

{

printf("The matrix is scalar\n");

}

}

getch();

return 0;

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C program to read and print a scalar matrix?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you write a program in java to read ten numbers and print sum of ten integers?

Add the numbers into one variable as you read them in. But if you prefer, you can read the numbers into an array and then use a loop to add the numbers together.


Write a program that read phrase and print the number of lower-case letter in it using function of counting?

write a program that reads a phrase and prints the number of lowercase latters in it using a function for counting? in C program


What is meant by the term fine print?

Fine print refers to the small text typically found at the bottom of a document or advertisement that contains important details or conditions regarding the product or service being offered. It often includes disclaimers, restrictions, or additional information that may not be prominently displayed in the main body of the text.


If you are straining to read fine print you may have a condition called?

The condition responsible for one straining to read fine print is presbyopia.


How do you write a program which reads a list of ten numbers and print the list in reserve order in c program?

The simplest way is probably to read the numbers into an array and then prints each element of the array starting at the last one and moving backwards.


How to Write a psuedocode algorithm to read in three numbers and print the highest and lowest number?

read num1 read num2 sum = num1 num2 print highest value


What are the child support and custody laws in NY?

The law is too long to print here. You can read the law at the related link.The law is too long to print here. You can read the law at the related link.The law is too long to print here. You can read the law at the related link.The law is too long to print here. You can read the law at the related link.


Can you write a program to read a set of scores from a file and compute the average and print it on the screenby c plus plus?

Yes. Use cin and/or getline to read the formatted data into an array, compute the average then output the result using cout.


How do you capture the output of C program in to another C program?

HIYou can first include the 1st program in ur 2nd program using # include and then whatever be the output from frst it can be used in second program.pankajThat's what popen is good for. Read the manual.


How do you print . epub files?

Use Adobe digital Editions to read epub files and there is a print button at the bottom to print.


When you have manipulated a matrix so that you can read the solution from it you have put it in reduced form?

True


When you have manipulated a matrix so that you can read the solution from it you have put it in reduced form.?

True