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
Elden [556K]
3 years ago
9

PHP Create a for loop that initialize with the variable $i = 10 The loop outputs $i as long as $i is greater than 1 using for lo

op Use echo statement to output $i Make sure to use operator based on the desired condition mentioned (increment $i++ / decrement $i–) Make sure each line of code ends with a semi colon i.e ;
Computers and Technology
1 answer:
Tanzania [10]3 years ago
4 0

Answer:

The PHP code is as follows

<?php

for ($i = 10; $i>1; $i--)

{

echo $i.' ';

}

?>

Explanation:

The code is self explanatory and doesn't require comments before it can easily understood.

The program starts with a php opening tag <?php

And it ends with the closing tag ?>

The interpretation of the question is to print integer values from 10 to 1

To do this, an iteration is needed.

The above program makes use of a for loop iteration.

Analysis;

for ( -> This shows that it is a for loop iteration

$i = 10; -> Iterating variable $i is initialized to 10 (that is; printing will start at 10)

$i>1; -> Iteration is valid while $i is greater than 1 (e.g. 2,3,4...10)

$i-- -> For every Iteration, decrease $i by 1

) -> End of Iterating condition

echo $i.' '; -> This line prints the valid values of $i. In this case, the values of $i is from 10 and stops at 2

The output is as follows

10 9 8 7 6 5 4 3 2

You might be interested in
Write a static method named anglePairs that accepts three angles (integers), measured in degrees, as parameters and returns whet
padilas [110]

Answer:

The java program for the scenario is given below.  

import java.util.*;

public class Test

{

// method returning sum of all digits in the integer parameter

static boolean anglePairs(int a1, int a2, int a3)

{

   // variable to hold sum of two complementary angles

   int comp=90;  

   // variable to hold sum of two supplementary angles

   int supp=180;

   // boolean variable to hold result

   boolean result = false;

   if( (a1+a2 == comp) || (a2+a3 == comp) || (a1+a3 == comp) )

   {

       if( (a1+a2 == supp) || (a2+a3 == supp) || (a1+a3 == supp) )

           result = true;

       else

           result = false;

   }    

           // return variable result

       return result;

}

public static void main(String[] args)

{

   // method is called by passing three positive angles

   System.out.println("The pair of angles have both complementary and supplementary angles " + anglePairs(100, 80, 90) );    

}

}

OUTPUT

The pair of angles have both complementary and supplementary angles false

Explanation:

The program works as described below.

1. The method, anglePairs(), is declared as static having return type as Boolean which takes three positive integer parameters.

static boolean anglePairs(int a1, int a2, int a3)

{

}

2. The integer variable, comp, is declared and initialized to 90.

3. The integer variable, supp, is declared and initialized to 180.

4. The Boolean variable, result, is declared and initialized to false.

5. Using if-else statements, sum of two angles are compared with the variables, comp and supp.

6. If the sum of any two angles match with both, comp and supp, variables, the Boolean variable, result is assigned value true. Otherwise, result is assigned value false.

7. The value of result is returned.

8. Inside main() method, the function anglePairs() is called and three positive numerical values are passed as parameters.  The output is displayed.

9. All the above code is written inside the class Test.

10. User input is not taken since it is not mentioned in the question.

8 0
3 years ago
When you use the tilde operator (~ in a url for the attribute of a server control, it represents the _____ directory of the webs
Verizon [17]
The tilde operator represents the root directory of the website.
4 0
3 years ago
How can i fix this, if i log in my acc it keeps saying wrong nickname or pass. even though my email and pass is correct
Oksanka [162]

Answer:

미안해요. 나는 우리가 단지 부동일 중 하나를 모르지만 그것을 해결하는 방법을 모른다!.

8 0
2 years ago
1. Describe the sequencing of factors influencing health status codes for patients that also have chronic conditions being manag
Vesnalui [34]
Bubyggyy tvtvtvttfrcrt
4 0
3 years ago
2 The software needed to send an email is:
Alexxx [7]

Answer:

C communication software

Explanation:

C communication software IS THE ANSWER

8 0
3 years ago
Other questions:
  • Answer this question please
    6·1 answer
  • A company currently uses Microsoft Active Directory as its identity provider. The company recently purchased Oracle Cloud Infras
    13·1 answer
  • Which magazine introduced the first microcomputer kit for the mits altair in its january 1975 issue?
    8·1 answer
  • Whixh options are available when a user modifies a recurring appointment. Check all that apply
    12·1 answer
  • A desktop computer (named workstation22) can’t connect to the network. A network card was purchased without documentation or dri
    15·1 answer
  • Is an electronics standard that allows different kinds of electronic instruments to
    12·1 answer
  • Decimal numbers are based on __________.
    6·1 answer
  • Which symbol is used for an assignment statement in a flowchart?
    13·1 answer
  • What type of hacker is primarily motivated by an ideology, epitomizing "the ends justify the means" mentality?.
    5·1 answer
  • You are using a device that reads the physical addresses contained in incoming data that travels along network cables. Based on
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!