JAVA_CODINGS Telegram 70
50. Double Matrix.

import java.util.*;
import java.text.DecimalFormat;

class DoubleMatrix
{
public static void main(String[] args)
{
double[][] a;
double[] s;
int row, col, k = 0, i, j;
double sum = 0.0;

DecimalFormat f = new DecimalFormat("##.####");
Scanner sc = new Scanner(System.in);

System.out.println("Enter size of row and column");
row = sc.nextInt();
col = sc.nextInt();

a = new double[row][col];
s = new double[col];

System.out.println("Enter elements of matrix");
for (i = 0; i < row; i++)
{
for (j = 0; j < col; j++)
{
a[i][j] = sc.nextDouble();
}
}

System.out.println("Double Matrix is : ");
for (i = 0; i < row; i++)
{
for (j = 0; j < col; j++)
{
System.out.print(" " + a[i][j]);
}
System.out.println();
}

//sum of the elements of double matrix

for (i = 0; i < col; i++)
{
for (j = 0; j < row; j++)
{
sum = sum + a[j][i];
}
s[k] = sum;
k++;
sum = 0;
}

for (i = 0; i < col; i++)
{
System.out.println("Sum of Column " + (i + 1) + " is : " + f.format(s[i]));
}
}
}

@java_codings



tgoop.com/java_codings/70
Create:
Last Update:

50. Double Matrix.

import java.util.*;
import java.text.DecimalFormat;

class DoubleMatrix
{
public static void main(String[] args)
{
double[][] a;
double[] s;
int row, col, k = 0, i, j;
double sum = 0.0;

DecimalFormat f = new DecimalFormat("##.####");
Scanner sc = new Scanner(System.in);

System.out.println("Enter size of row and column");
row = sc.nextInt();
col = sc.nextInt();

a = new double[row][col];
s = new double[col];

System.out.println("Enter elements of matrix");
for (i = 0; i < row; i++)
{
for (j = 0; j < col; j++)
{
a[i][j] = sc.nextDouble();
}
}

System.out.println("Double Matrix is : ");
for (i = 0; i < row; i++)
{
for (j = 0; j < col; j++)
{
System.out.print(" " + a[i][j]);
}
System.out.println();
}

//sum of the elements of double matrix

for (i = 0; i < col; i++)
{
for (j = 0; j < row; j++)
{
sum = sum + a[j][i];
}
s[k] = sum;
k++;
sum = 0;
}

for (i = 0; i < col; i++)
{
System.out.println("Sum of Column " + (i + 1) + " is : " + f.format(s[i]));
}
}
}

@java_codings

BY Advance Java πŸ‘¨β€πŸ’»


Share with your friend now:
tgoop.com/java_codings/70

View MORE
Open in Telegram


Telegram News

Date: |

The best encrypted messaging apps Today, we will address Telegram channels and how to use them for maximum benefit. Commenting about the court's concerns about the spread of false information related to the elections, Minister Fachin noted Brazil is "facing circumstances that could put Brazil's democracy at risk." During the meeting, the information technology secretary at the TSE, Julio Valente, put forward a list of requests the court believes will disinformation. But a Telegram statement also said: "Any requests related to political censorship or limiting human rights such as the rights to free speech or assembly are not and will not be considered." Telegram offers a powerful toolset that allows businesses to create and manage channels, groups, and bots to broadcast messages, engage in conversations, and offer reliable customer support via bots.
from us


Telegram Advance Java πŸ‘¨β€πŸ’»
FROM American