c:
#include<stdio.h>
int main(){
float a[4],b[4],c[4],d[4],e[4];
for(int i=0;i<5;i++){
scanf("%f",&a[i]);
printf("%.1f ",a[i]);
}
printf("%.1f\n",a[1]+a[2]+a[3]+a[4]+a[0]);
for(int i=0;i<5;i++){
scanf("%f",&b[i]);
printf("%.1f ",b[i]);
}
printf("%.1f\n",b[1]+b[2]+b[3]+b[4]+b[0]);
for(int i=0;i<5;i++){
scanf("%f",&c[i]);
printf("%.1f ",c[i]);
}
printf("%.1f\n",c[1]+c[2]+c[3]+c[4]+c[0]);
for(int i=0;i<5;i++){
scanf("%f",&d[i]);
printf("%.1f ",d[i]);
}
printf("%.1f\n",d[1]+d[2]+d[3]+d[4]+d[0]);
for(int i=0;i<5;i++){
scanf("%f",&e[i]);
printf("%.1f ",e[i]);
}
printf("%.1f\n",e[1]+e[2]+e[3]+e[4]+e[0]);
}
c++:
#include<bits/stdc++.h>
using namespace std;
int main(){
double a[5][5];
double sum[5];
for(int i=0;i<5;i++){
sum[i]=0;
for(int j=0;j<5;j++){
cin>>a[i][j];
sum[i]=sum[i]+a[i][j];
cout<<a[i][j]<<" ";
}
cout<<sum[i]<<endl;
}
}
//矩阵定义;
java:
import java.io.*;
public class Main{
public static void main(String[]args)throws IOException{
BufferedReader br=new BufferedReader (new InputStreamReader(System.in));
//Double a[][]=new double[5][5];
double[][] a=new double[5][5];
//double c[5];初始化
double[] c=new double[5];
for(int i=0;i<5;i++){
String []s=br.readLine().split(" ");//位置
c[i]=0;
for(int j=0;j<5;j++){
a[i][j]=Double.parseDouble(s[j]);
c[i]=c[i]+a[i][j];
System.out.printf("%.1f ",a[i][j]);
}
System.out.printf("%.1f\n",c[i]);
}
}
}
//readline的位置;double数组的定义