Answer:
Written in Python
import math
degreesF = float(input("Enter a temperature in degrees Fahrenheit: "))
degreesC = round(5 * (degreesF - 32)/9,1)
print(degreesC)
Explanation:
The following header allows you to use Math.Round() method in Python
import math
The following prompts the user for temperature in degrees Fahrenheit
degreesF = float(input("Enter a temperature in degrees Fahrenheit: "))
The following calculates the degree Celsius equivalent and also round it up
degreesC = round(5 * (degreesF - 32)/9,1)
The following prints the degree Celsius equivalent
print(degreesC)
Millions of dollars in legal fees have been spent attempting to define what qualifies as a fair use.
There are no hard-and-fast rules, only general guidelines and varied court decisions, because the judges and lawmakers who created the fair use exception did not want to limit its definition.
Like free speech, they wanted it to have an expansive meaning that could be open to interpretation.
Answer:
public class MagicSquare {
public static void main(String[] args) {
int[][] square = {
{ 8, 11, 14, 1},
{13, 2, 7,12},
{ 3, 16, 9, 6},
{10, 5, 4, 15}
};
System.out.printf("The square %s a magic square. %n",
(isMagicSquare(square) ? "is" : "is not"));
}
public static boolean isMagicSquare(int[][] square) {
if(square.length != square[0].length) {
return false;
}
int sum = 0;
for(int i = 0; i < square[0].length; ++i) {
sum += square[0][i];
}
int d1 = 0, d2 = 0;
for(int i = 0; i < square.length; ++i) {
int row_sum = 0;
int col_sum = 0;
for(int j = 0; j < square[0].length; ++j) {
if(i == j) {
d1 += square[i][j];
}
if(j == square.length-i-1) {
d2 += square[i][j];
}
row_sum += square[i][j];
col_sum += square[j][i];
}
if(row_sum != sum || col_sum != sum) {
return false;
}
}
return d1 == sum && d2 == sum;
}
}