Docstoc

29

Document Sample
29 Powered By Docstoc
					#include<iostream.h> #include<conio.h> #include<fstream.h> fstream f("mat.in",ios::in); void main() { clrscr(); int a[10][10],n,i,j,s=0; f>>n; for(i=1;i<=n;i++) for(j=1;j<=n;j++) f>>a[i][j]; for(i=1;i<=n;i++) { for(j=1;j<=n;j++) cout<<a[i][j]; cout<<endl; } cout<<endl;

for(i=1;i<=n;i++) {for(j=1;j<=n;j++) if(j>i)

s=s+a[i][j];}

cout<<"suma elementelor de deasupra diagonalei principale este s="<<s; getch(); }


				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:17
posted:10/30/2008
language:
pages:1