Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- void nhap(double **arr,int dong,int cot)
- {
- for(int i=0;i<dong;i++)
- {
- for(int j=0;j<cot;j++)
- {
- scanf("%lf",*(arr+i)+j);
- }
- }
- }
- double tong(double **arr,int dong,int cot,int kt)
- {
- double sum=0;
- for(int i=0;i<dong;i++)
- {
- if(i+1==kt)
- {
- for(int j=0;j<cot;j++)
- {
- sum+=*(*(arr+i)+j);
- }
- break;
- }
- }
- return sum;
- }
- int main()
- {
- int dong,cot;
- scanf("%d%d",&dong,&cot);
- double **arr=(double **)calloc(dong,sizeof(double*));
- for(int i=0;i<dong;i++)
- {
- *(arr+i)=(double *)calloc(cot,sizeof(double));
- }
- nhap(arr,dong,cot);
- int kt;
- scanf("%d",&kt);
- printf("%.2lf",tong(arr,dong,cot,kt));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement