Answer:
The solution code is written in Java.
- public class Main {
- public static void main(String[] args) {
- System.out.print("Please enter a number: ");
- Scanner console = new Scanner(System.in);
- int n = console.nextInt();
- calculateSum1(n);
- calculateSum2(n);
- calculateSum3(n);
- calculateSum4(n);
- }
- public static void calculateSum1 (int num){
- int sum1 = 0;
- for(int i=1; i <= num; i++){
- sum1 += i*i*i;
- }
- System.out.println("Sum 1 : " + sum1);
- }
- public static void calculateSum2 (int num){
- int sum2 = num * num * (num + 1) * (num + 1) / 4;
- System.out.println("Sum 2 : " + sum2);
- }
- public static void calculateSum3 (int num){
- int sum3 = 0;
- for(int i=1; i <=num; i++){
- sum3 += i;
- }
- sum3 = sum3 * sum3;
- System.out.println("Sum 3 : " + sum3);
- }
- public static void calculateSum4 (int num){
- int sum4 = (num * (num + 1) * (2*num + 1)) / (4+2);
- System.out.println("Sum 4 : " + sum4);
- }
- }
Explanation:
Firstly we create four different methods that calculate the sum of the first n cubes in different ways (Line 13 - 43).
This is important to understand the concept of operator precedence to work out the different ways of summation.
For example, The operator * and / will always have higher precedence than +.
On another hand, any expression enclosed within the parenthesis will have highest precedence and therefore the value will be evaluated prior to others.
This is also important to understand the expression evaluation will always start from left to right.
Answer:
We use the internet because it is a way of finding certain things out that we do not know or a better way of communicating to people who are far away instead of sending a letter to them and it taking 2 to 3 months for it to get to that person.
Explanation:
Your welcome
A Hub transmits all data received to all network devices connected to it, regardless of which device the data exists being sent to.
<h3>What is Hub?</h3>
A hub stands for the connection point in a computer device where data from numerous directions converge and are then sent out in many directions to respective devices. A hub may even act as a switch by preventing distinct data packets from proceeding to a destination. There exist three types of network hubs: passive, active, and intelligent.
A network hub exists as a node that broadcasts data to every computer or Ethernet-based device connected to it. A hub stands less sophisticated than a switch, the latter of which can isolate data transmissions to specific devices. Network hubs stand best suited for small, simple local area network (LAN) environments.
Hence, A Hub transmits all data received to all network devices connected to it, regardless of which device the data exists being sent to.
To learn more about Hub refer to:
brainly.com/question/25804256
#SPJ4
Answer and Explanation:
First of all we should have to know about PMT
PMT
stands for payment .payment that you want to send and receive.It is used in financial calculators and equation. It is a payment that return the periodic payment for a loan.
From the given statement we have to calculate the PMT for this purpose .
let us consider example where we take loan amount and have some interest and then calculate it.
loan of amount = $6000.00
Interest rate = 4.20%
period per year=15
period = 60
then monthly payment = $ 111.40
Using Excel then we get the monthly payment in cell C9
as calculations has been shown in the excel.
where you can get function who returns a positive value.
Answer:
b. 16
Explanation:
The given PHP code segment consists of 2 statements.
$str="The quick brown fox jumps over the lazy dog";
This defines a variable $str and assigns the given text to it.
echo strpos($str,'fox');
This statement prints the location of 'fox' in the text associated with the variable $str.
Upon execution it will print the value 16 which corresponds to the position of 'fox' in the given sentence.