Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Homework
//'main' method must be in a class 'Rextester'. //openjdk version '11.0.5' import java.util.*; class Rextester { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int r,c,i,j,s1,s2; System.out.println("Enter no. Of rows and columns"); r=sc.nextInt(); c=sc.nextInt(); int a[][]=new int[r][c]; for(i=0;i<r;i++) { System.out.println("Enter numbers for "+(i+1)+" row"); for(j=0;j<c;j++) a[i][j]=sc.nextInt(); } for(i=0;i<c;i++) { s1=0; System.out.print("Sum of "+(i+1)+" column is:"); for(j=0;j<r;j++) s1=s1+ a[j][i]; System.out.println(s1); s2=0; } for(i=0;i<r;i++) { s2=0; System.out.println("Sum of "+(i+1)+" row is:"); for(j=0;j<c;j++) s2=s2+ a[i][j]; System.out.println(s2); } } }
run
|
edit
|
history
|
help
0
Desvio Padrão - LPI
evenloop
Shortest distance between words
Random number
forloop1
PE #4
Check Input
kkk
LambdaExpression
Problem: fb_series