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
Write a recursive function that takes a non-negative integer as an argument and displays the same number in reverse order (i.e.
avanturin [10]

Answer:

Following are the program in C++ language

#include<iostream> // header file

using namespace std; // namespace std

int reverse(int n1); // function prototype

int main()  // main function()

{

   int num; // Variable declaration

   cout << "Enter the number" << endl;

   cin >> num; // Read the number bu the user

  cout<<"After Reverse the digit:\n";

   int res= reverse(num); // calling function reverse

   

   cout<<res; // display  

}

int reverse(int n1) // function definition of reverse

{

   if (n1<10)  // checking the base condition

       {

           return n1;

       }

   else

       {

           cout << n1 % 10; // Printed the last digit

          return reverse(n1/10); // calling itsself

}

}

Output:

Enter the number:

76538

After Reverse the digit:

83567

Explanation:

Following are the description of the program

  • In the main function read the number by user in the "num" variable of int type.
  • Calling the reverse and pass that "num" variable into it.
  • After calling the control moves to the body of the reverse function.In this function we check the two condition

        1  base condition

   if (n1<10)  // checking the base condition

       {

           return n1;

     }

      2  General condition

  else

       {

           cout << n1 % 10; // Printed the last digit

          return reverse(n1/10); // calling itsself

       }

  • Finally return the reverse number and display them into the main function.
5 0
3 years ago
after clicking the start button on your computer screen desktop what option would you then select to examine system components y
Len [333]
Start>hover over "Computer">right-click>Properties>shows system specs

Start>Control Panel>lets you modify network connections, change time and date, update, uninstall programs, add new hardware, etc.
7 0
2 years ago
Which password attack method uses long lists of words that have been predefined and can be quickly downloaded for use to break a
vova2212 [387]

Answer:

A dictonary attack.

Explanation:

Dictionaries hold many words that can be downloaded and used. Word or name passwords are usually just one word or maybe two. In other words, predefined words being used as a password? Not safe. When someone attempts to crack it, they use brute force attacks. Among these are dictionary attacks, which focus on the actual words rather than numbers.

3 0
2 years ago
Write a RainFall class that stores the total rainfall for each of 12 months into an array of doubles. The program should have me
RSB [31]

Answer:

Explanation:

The code provided worked for the most part, it had some gramatical errors in when printing out the information as well as repeated values. I fixed and reorganized the printed information so that it is well formatted. The only thing that was missing from the code was the input validation to make sure that no negative values were passed. I added this within the getMonths() method so that it repeats the question until the user inputs a valid value. The program was tested and the output can be seen in the attached image below.

import java.io.*;

import java.util.*;

class Rainfall

{

   Scanner in = new Scanner(System.in);

   private int month = 12;

   private double total = 0;

   private double average;

   private double standard_deviation;

   private double largest;

   private double smallest;

   private double months[];

   public Rainfall()

   {

       months = new double[12];

   }

   public void setMonths()

   {

       for(int n=1; n <= month; n++)

       {

           int answer = 0;

           while (true) {

               System.out.println("Enter the rainfall (in inches) for month #" + n + ":" );

               answer = in.nextInt();

               if (answer > 0) {

                   months[n-1] = answer;

                   break;

               }

           }

       }

   }

   public void getTotal()

   {

       total = 0;

       for(int i = 0; i < 12; i++)

       {

           total = total + months[i];

       }

       System.out.println("The total rainfall for the year is " + total);

   }

   public void getAverage()

   {

       average = total/12;

       System.out.println("The average monthly rainfall is " + average);

   }

   public void getLargest()

   {

       double largest = 0;

       int largeind = 0;

       for(int i = 0; i < 12; i++)

       {

           if (months[i] > largest)

           {

               largest = months[i];

               largeind = i;

           }

       }

       System.out.println("The largest amount of rainfall was " + largest +

               " inches in month " + (largeind + 1));

   }

   public void getSmallest()

   {

       double smallest = Double.MAX_VALUE;

       int smallind = 0;

       for(int n = 0; n < month; n++)

       {

           if (months[n] < smallest)

           {

               smallest = months[n];

               smallind = n;

           }

       }

       System.out.println("The smallest amount of rainfall was " + smallest +

               " inches in month " + (smallind + 1));

   }

   public static void main(String[] args)

   {

       Rainfall r = new Rainfall();

       r.setMonths();

       r.getTotal();

       r.getSmallest();

       r.getLargest();

       r.getAverage();

   }

}

8 0
2 years ago
You are configuring a wireless network with two wireless access points. Both access points connect to the same wired network. Yo
-BARSIC- [3]

Answer:

b. Same SSID, different channel

Explanation:

The Service Set Identifier (SSID) is a sequence that is included in all of the sets in a wirless network and helps identify them as part of the network. Because both points connec to the same network they need the same SSID.

7 0
3 years ago
Other questions:
  • Are we too dependent on technology if yes then can you please explain?
    12·2 answers
  • Without protocols the information sent and received through the Internet would never reach its intended target and even if it di
    6·1 answer
  • When discussing the data-modeling building blocks, anything (a person, a place, a thing, or an event) about which data are to be
    15·1 answer
  • Suppose that outFileis an ofstreamvariable and output is to be stored in the file outputData.out. Which of the following stateme
    14·1 answer
  • What is emerging as a major business area of innovation that offers a flexible collection of computers on the internet that can
    6·1 answer
  • Which of the following is an example of a trade journal?
    7·2 answers
  • Match each method of communication with its intended purpose.
    14·1 answer
  • Of what is famous Ted Nelson?​
    8·1 answer
  • Define a function print_feet_inch_short(), with parameters num_feet and num_inches, that prints using ' and " shorthand. End wit
    6·2 answers
  • What does a companys code of ehtics cover
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!