Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream.h>
- #include<conio.h>
- #define m 3
- #define n 3
- void main()
- {
- int i, j, sum=0;
- int x[m][n]={{5,6,7},
- {8,9,10},
- {11,12,13},
- };
- float average;
- clrscr();
- for(i=0; i<m; i++)
- for(j=0; j<n; j++)
- {
- cout<<"x["<<i<<"]["<<j<<"]="<<x[i][j]<<endl;
- sum=sum+x[i][j];
- }
- cout<<"sum of the numbers="<<sum<<endl;
- average=sum/(float)(m*n);
- cout<<"average="<<sum<<"/"<<m*n<<endl;
- cout<<"average of the sum="<<average<<endl;
- int min, max;
- int a[9]={5,6,7,8,9,10,11,12,13};
- for(i=0; i<9; i++)
- min=max=a[0];
- for(i=0; i<9; i++)
- {
- if(a[i]>max)
- max=a[i];
- }
- {
- if(a[i]<min)
- min=a[i];
- }
- cout<<" minimum number of the given array="<<min<<endl;
- cout<<" maximum number of the given array="<<max<<endl;
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment