Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int i,j,a[3][3];
- //input array
- for(i=0;i<=2;i++)
- {
- for(j=0;j<=2;j++)
- {
- cout<<"["<<i<<"]["<<j<<"]";
- cin>>a[i][j];
- }
- }
- //output array
- for(i=0;i<=2;i++)
- {
- for(j=0;j<=2;j++)
- {
- cout<<a[i][j]<<"\t";
- }
- cout<<endl<<endl;
- }
- //procces find av for lower traingle diameter
- int n=0,x=0,sum=0;
- for(i=0;i<=2;i++)
- {
- for(j=0;j<=n;j++)
- {
- sum+=a[i][j];
- x++;
- }
- n++;
- }
- float av=sum/x;
- cout<<"Av = "<<av;
- }
Advertisement
Add Comment
Please, Sign In to add comment