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;
}
Chat with our AI personalities
write a program that reads a phrase and prints the number of lowercase latters in it using a function for counting? 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.
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.
see pages 43-49 in Principles of Program design by M. A. Jackson, 1975
Program Store Enable: The read strobe to external program memory.