CODING:
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10][10],m,n,i,j,sum;
double am[10];
clrscr();
printf("Enter order of matrix ");
scanf("%d%d",&m,&n);
printf("Enter values of matrix\n");
for(i=1;i<=m;i++)
{
sum=0;
for(j=1;j<=n;j++)
{
printf("Enter value of a[%d][%d] ",i,j);
scanf("%d",&a[i][j]);
sum=sum+a[i][j];
}
am[i]=(double)sum/n;
}
for(i=1;i<=m;i++)
{
printf("\nArithmetic Mean of row %d = %f",i,am[i]);
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10][10],m,n,i,j,sum;
double am[10];
clrscr();
printf("Enter order of matrix ");
scanf("%d%d",&m,&n);
printf("Enter values of matrix\n");
for(i=1;i<=m;i++)
{
sum=0;
for(j=1;j<=n;j++)
{
printf("Enter value of a[%d][%d] ",i,j);
scanf("%d",&a[i][j]);
sum=sum+a[i][j];
}
am[i]=(double)sum/n;
}
for(i=1;i<=m;i++)
{
printf("\nArithmetic Mean of row %d = %f",i,am[i]);
}
getch();
}
CODING |
OUTPUT |
For any query or suggestion please comment below...
what is the code if i want to find the mean of those calculated arithemtic mean for each row?
ReplyDeleteFor this, you havr to add all arithmetic mean values (i.e. array a[ ]) and divide it with number of values. That's all. You will need 'for' loop for this. If you want exact code for this then tell me, I will reply you with exact code as soon as possible.
DeleteTill then, keep visiting.