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
Kaylis [27]
3 years ago
5

What happens if you try to compile and run this program?

Computers and Technology
1 answer:
Lynna [10]3 years ago
7 0

Your question is poorly formatted

<em>#include <stdio.h> </em>

<em>int main(void) { </em>

<em>int i, t[4]; </em>

<em>t[3] = 0; </em>

<em>for (i = 1; i >= 0; i--) </em>

<em>t[i] = t[3] * i; </em>

<em>printf("%d", +t[1]); </em>

<em>return 0; </em>

<em>}</em>

Answer:

It outputs 0

Explanation:

I'll start my explanation from the third line

This line declares an integer variable i and an array of 4 elements of type integer

<em>int i, t[4]; </em>

<em />

This line initialize the 3rd index element to 0

<em>t[3] = 0; </em>

<em />

The next two lines is an iteration;

The first line of the iteration iterates the value of i in descending order from 1 to 0

<em>for (i = 1; i >= 0; i--) </em>

<em />

This line of the iteration calculates t[1] as t[3] * i and t[0] as t[3] * i; Since t[3] is 0; both t[1] and t[0] will be 0

<em>t[i] = t[3] * i; </em>

<em />

This line prints t[1] which is 0

<em>printf("%d", +t[1]); </em>

You might be interested in
Consider an interface p ublic interface NumberFormatter { String format (in n); } Provide four classes that implement this inter
sesenic [268]

Answer and Explanation:

Here is the code for the question with output.

public interface NumberFormatter {

  public String format(int n);

}

class DefaultFormatter implements NumberFormatter

{

  public String format(int n)

  {

      return String.valueOf(n);

  }

}

class DecimalFormatter implements NumberFormatter

{

  public String format(int n)

  {

      return String.format("%,d",n); //formats the number by putting comma for 3 digits

  }

}

class AccountingFormatter implements NumberFormatter

{

  public String format(int n)

  {

      return String.format("(%d)",n);

  }

}

class BaseFormatter implements NumberFormatter

{

  int base;

 

  public BaseFormatter(int b)

  {

         

      base = b;

      if(base < 2 || base > 36) //if values out of range 2-36 inclusive are given, set default to 2

          base = 2;

  }

  public String format(int n)

  {

      return Integer.toString(n, base);      

  }

  int getBase()

  {

      return base;

  }

}

public class TestNumberFormatter {

  private static void print(int n, NumberFormatter formatter)

  {

      String s = String.format("%15s",formatter.format(n));

      System.out.print(s);

  }

  public static void main(String[] args) {

      int numbers[]= {100,55555,1000000,35,5};

      DefaultFormatter defFmt = new DefaultFormatter();

      DecimalFormatter deciFmt = new DecimalFormatter();

      AccountingFormatter accFmt = new AccountingFormatter();

      BaseFormatter baseFmt=new BaseFormatter(16) ; //base 16

      String s;

     

      System.out.println("\tDefault \t Decimal \tAccounting \t Base("+baseFmt.getBase()+")");

      for(int i = 0; i < numbers.length; i++)

      {

          print(numbers[i], defFmt);

          print(numbers[i], deciFmt);

          print(numbers[i], accFmt);

          print(numbers[i], baseFmt);

          System.out.println();//new line

      }

     

  }

}

output

  Default    Decimal    Accounting    Base(16)

100 100 (100) 64

55555 55,555 (55555) d903

1000000 1,000,000 (1000000) f4240

  35 35 (35) 23

5 5 (5) 5

3 0
3 years ago
Escribe todas las posibles combinaciones que pueden haber entre 4 bits.
Vedmedyk [2.9K]

Answer:

The answer is "\bold{2^n\ \  _{where} \ \ \ n \ is\ bit }"

Explanation:

The Combinations could be produced by using n-bits 2^n . It s enables you to generate the 4-bit numbers that are:

\to  2^4 = 16 combinations.

for the 4-bit, the combination of 2 = 16, which are its possible combination and for the   10 variations  appropriate 16 combinations are used,  As we know for 4 bit 16 Combinations can be generated which are from 0 to 15.

7 0
3 years ago
When listing columns in the select list, what should you use to separate the columns?
Gala2k [10]
The answer is commas.  <span>When listing columns in the select list, commas should be used to separate the columns.</span>
6 0
4 years ago
You need to add cells c3 and c7, and multiply c3 by c6. based on the order of operations, what would you do
Julli [10]
Multiply first, and then add.
6 0
3 years ago
Read 2 more answers
In a swap you need a _____________ variable so that one of the values is not lost.
Marat540 [252]

Answer:

i would love to actually answer this im so sorry

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • For questions 1 – 3, use the following partial class definitions:
    11·1 answer
  • Suppose for the worst case, given input size n: Algorithm 1 performs f(n) = n2 + n/2 steps Algorithm 2 performs f(n) = 12n + 500
    6·1 answer
  • What three things in the third generation of computing helped get programming enthusiasts more involved with computers? Select 3
    12·2 answers
  • Which windows 10 edition can a device with windows 8 or 8.1 pro upgrade to
    5·1 answer
  • Question #17<br> Describe the two methods to open the "Conditional format rules" pane.
    13·1 answer
  • What is a Forloop and what is it used for?
    7·2 answers
  • What is the main advantage of using a WYSIWYG("what you see is what you get")editor when constructing a website
    5·1 answer
  • Basic python coding, What is the output of this program? Assume the user enters 2, 5, and 10.
    8·1 answer
  • where element is the Hypertext Markup Language (HTML) element and _____ pairs define the styles that are applied directly to tha
    6·1 answer
  • Question # 5
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!