Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Tinh tong so duong tren mang so thuc 2 chieu
- // Khai bao cac ham thu vien neu co
- #include<stdio.h>
- #include<conio.h>
- #define SIZE 100
- void nhap(float a[][100],int &m,int &n)
- {
- scanf("%d%d", &m,&n);
- float x;
- for(int i=0;i<m;i++)
- {
- for(int j=0;j<n;j++)
- {
- scanf("%f",&x);
- a[i][j]=x;
- }
- }
- }
- void xuly(float a[][100],int m,int n)
- {
- double s=0;
- for(int i=0;i<m;i++)
- {
- for(int j=0;j<m;j++)
- {
- if((a[i][j])>0)
- {
- s=s+a[i][j];
- }
- }
- }
- printf("%.2lf",s);// lay 2 gia tri thap phan
- }
- void main()
- {
- float a[SIZE][SIZE];
- int m,n;
- nhap(a,m,n);
- xuly(a,m,n);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement