1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
leonid [27]
3 years ago
6

Consider the following two code segments: Segment 1: while (k > 0) { System.out.println(k); k--; } --------------- Segment 2:

while (k > 0) { System.out.println(k); k--; } while (k > 0) { System.out.println(k); k--; } Assume that in both cases variable k has the same initial value. Under which of the following conditions will the two code segments produce identical output.

Computers and Technology
1 answer:
zepelin [54]3 years ago
6 0

Answer:

Always same value

Explanation:

These both code segments will always generate identical values given that we provide same value of k to both segments.

You can see attached pictures.

You might be interested in
Write a program to calculate the great circle distance between two points on the surface of a sphere. If p1(x1, y1) and p2(x2,y2
Tamiku [17]

Answer:

import java.lang.*;

public class distance { public static double distance(double latitude1,

                                     double latitude2, double longitude1,

                                     double longitude2)

       {

      // Convert Latitude and Longitude to Radians

           longitude1 = Math.toRadians(longitude1);

           longitude2 = Math.toRadians(longitude2);

           latitude1 = Math.toRadians(latitude1);

           latitude2 = Math.toRadians(latitude2);

           

           double d_longitude = longitude2 - longitude1;

           double d_latitude = latitude2 - latitude1;

           double a = Math.pow(Math.sin(d_latitude / 2), 2)

                   + Math.cos(latitude1) * Math.cos(latitude2)

                   * Math.pow(Math.sin(d_longitude / 2),2);

           double val = 2 * Math.asin(Math.sqrt(a));

           // Radius of earth in kilometers is 6371

           double earth_radius = 6371;

           // Calculate and return the distance

           return(val * earth_radius);

       }

       // Main Method

       public static void main(String[] args)

       {

           double latitude1 = 67.32055555555556;

           double latitude2 = 83.31861111111111;

           double longitude1 = -1.7217899;

           double longitude2 = -1.6567799;

           System.out.println(distance(latitude1, latitude2,

                   longitude1, longitude2) + " K.M");

       }

   }

Explanation:

This program is implemented in Java programming language

The formula for the shortest distance between two points on the earth is:

Distance = 3963.0 * arccos[(sin(lat1) * sin(lat2)) + cos(lat1) * cos(lat2) * cos(long2 – long1)]

The latitude and longitude of the two points must be known

The latitude and longitude are converted into radians using built in methods in java.

Take value for the radius of the earth in Kilometers  6371;

Note that a seperate method has been created to calculate the distance

In the driver method (main), values for latitude and logitudes for both places have been hard-corded, then the method distance is called and passed those values

Note also that the distance has been calculated in Kilometers

8 0
3 years ago
What is prototyping in system design phase? Under what condition this approach is most suited? Also what is the disadvantage of
Novay_Z [31]
Prototyping refers to the process of developing prototypes. Prototype model is most suitable for use when the desired system requires a lot of interaction with the end users. One of the disadvantages of prototyping is the extra funds that is spent on the development of the prototypes. Another disadvantage is the accuracy of the prototype. 
8 0
3 years ago
Explain why it is important to always plug your computer into a surge protector.
Feliz [49]
A surge protector is designed to protect electrical devices from voltage spikes. It limits the voltage supplied by blocking or shorting to ground any unwanted voltages above a safe threshold.  
3 0
3 years ago
Write a loop that displays all possible combinations of two letters where the letters are 'a', or 'b', or 'c', or 'd', or 'e'. t
Andru [333]
for (char first = 'a'; first <= 'e'; first++) {    
   for (char second = 'a'; second <= 'e'; second++) {
      printf("%c%c\n", first, second);    
   }
}
3 0
4 years ago
3. What are the first steps that you should take if you are unable to get onto the Internet? (1 point)
slavikrds [6]

Answer:

Check your router connections then restart your router.

Explanation:

When the internet connection is not displaying properly then the first step is to check the router. The network icon on the internet displays the availability of internet. Adjust the router and see if the router is working properly. If not restart the router so that it adjusts its settings to default. The connection will be available on the computer and internet will start working normally.

3 0
4 years ago
Other questions:
  • Which statement is true about customizing presentation programs?
    6·1 answer
  • Using Word, Maureen is writing an outline of a presentation she plans to give to her company. She will be showing a video during
    12·2 answers
  • Every file on a storage device has a _______. (a.) name (b.) size (c.)both of the above (d.) none of the above
    10·1 answer
  • Addition and subtraction are considered to be ____ operations performed by a computer.
    7·1 answer
  • Write a Java Program that can compute the mean, median, the highest, and the lowest of the students’ scores in a class. First, t
    6·1 answer
  • What is the navigation aid that shows users the path they have taken to get to a web page located within a website?
    12·1 answer
  • What is the unemployment rate if the GDP gap is 13.5%?<br><br> A. 6.25%<br> B. 6.75%<br> C. 6.7%
    8·1 answer
  • Which of the following is an example of the rewards &amp; consequences characteristic of an organization?
    10·2 answers
  • if ur parent gets mad at u and says something then u say something, why do they say "stop back talking'' if ur just starting a c
    7·2 answers
  • Indicate whether the following statements are true or false:
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!