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 c++program that allows the user to enter the last names of fivecandidates in a local election and the number of votes re
madreJ [45]

Answer:

#include<iostream>

#include<stdlib.h>

using namespace std;

int main(){

   //initialization

   string str1[5];

   int arr_Vote[5];

   int Total_Vote=0,max1_Index;

   int max1=INT_MIN;

   //loop for storing input enter by user

   for(int i=0;i<5;i++){

       cout<<"Enter the last name of candidate: "<<endl;

       cin>>str1[i];

       cout<<"Enter the number of vote receive by the candidate: "<<endl;

       cin>>arr_Vote[i];

       //calculate the sum

       Total_Vote = Total_Vote + arr_Vote[i];

       //find the index of maximum vote

       if(arr_Vote[i]>max1){

           max1=arr_Vote[i];

           max1_Index=i;

       }

   }

   //display

   cout<<"\nThe output is......"<<endl;

   //loop for display data of each candidate

   for(int i=0;i<5;i++){

       cout<<str1[i]<<"\t"<<arr_Vote[i]<<"\t"     <<float(arr_Vote[i]*100)/Total_Vote<<"%"<<endl;

   }

   //display winner

   cout<<"The winner candidate is"<<endl;

   cout<<str1[max1_Index]<<"\t"<<arr_Vote[max1_Index]<<"\t"<<float(arr_Vote[max1_Index]*100)/Total_Vote<<" %"<<endl;

}

Explanation:

Create the main function and declare the two arrays and variables.

the first array for storing the names, so it must be a string type. second array stores the votes, so it must be int type.

after that, take a for loop and it runs for 5 times and storing the values entered by the user in the arrays.

we also calculate the sum by adding the array data one by one.

In the same loop, we also find the index of the maximum vote. take an if statement and it checks the element in the array is greater than the max1 variable. Max1 variable contains the very small value INT_MIN.

If condition true, update the max1 value and update the max1_Index value.

The above process continues for each candidate for 5 times.

After that, take a for loop and display the data along with percentage by using the formula:

Vote\,percent=\frac{Vote\,receive*100}{Total\,vote}

the, finally display the winner by using the max1_Index value.  

5 0
3 years ago
Which of the following is the term for a device (usually external to a computer) that is plugged into a computer's communication
Serjik [45]

A device, usually external to a computer that is plugged into a computer's communication port or is connected wirelessly. Common peripherals are keyboards, mice, monitors, speakers, and printers

4 0
3 years ago
If a user wants to add an expansion card to increase the memory of a computer, where should the user insert the card?
uysha [10]

into a port on the outside of the computer


6 0
3 years ago
Read 2 more answers
Which of the following is not an advantage of concurrent design?
viva [34]

The answer I believe is B

7 0
3 years ago
Read 2 more answers
four quantum numbers that could represent the last electron added (using the Aufbau principle) to the Argon atom. A n = 2, l =0,
marshall27 [118]

Answer:

  • n = 3
  • l  = 1
  • m_l = 1
  • m_s=+1/2

Explanation:

Argon atom has atomic number 18. Then, it has 18 protons and 18 electrons.

To determine the quantum numbers you must do the electron configuration.

Aufbau's principle is a mnemonic rule to remember the rank of the orbitals in increasing order of energy.

The rank of energy is:

1s < 2s < 2p < 3s < 3p < 4s < 3d < 4p < 5s < 4d < 5p < 6s < 4f < 5d < 6p < 7s < 5f < 6d < 7d

You must fill the orbitals in order until you have 18 electrons:

  • 1s² 2s² 2p⁶ 3s² 3p⁶   : 2 + 2 + 6 + 2 + 6 = 18 electrons.

The last electron is in the 3p orbital.

The quantum numbers associated with the 3p orbitals are:

  • n = 3

  • l = 1 (orbitals s correspond to l = 0, orbitals p correspond to l  = 1, orbitals d, correspond to l  = 2 , and orbitals f correspond to  l = 3)

  • m_l can be -1, 0, or 1 (from - l  to + l )

  • the fourth quantum number, the spin can be +1/2 or -1/2

Thus, the six possibilities for the last six electrons are:

  • (3, 1, -1 +1/2)
  • (3, 1, -1, -1/2)
  • (3, 1, 0, +1/2)
  • (3, 1, 0, -1/2)
  • (3, 1, 1, +1/2)
  • (3, 1, 1, -1/2)

Hence, the correct choice is:

  • n = 3
  • l  = 1
  • m_l = 1
  • m_s=+1/2
5 0
3 years ago
Other questions:
  • What must be done if the intended destination hardware is not supported by the chosen OS?
    6·1 answer
  • Write a function "nonRepeatings" that takes a string "s3" and returns the non-repeating characters in this string. Sample Input
    11·1 answer
  • Counter-controlled repetition is also known as:
    8·1 answer
  • Can you give me a long list of anime
    6·2 answers
  • Benching system are prohibited in
    5·1 answer
  • Research and build a chroot jail that isolates ssh users who belong to the restrictssh group. (You will also need to create the
    9·1 answer
  • 4. In computers, an integer can be represented by more than 8-bit, what is the largest positive integer that
    9·1 answer
  • Goals of the project objectives
    6·1 answer
  • When you save a presentation with a .potx file extension, which type of powerpoint file is created?
    8·1 answer
  • Ryan would like to copy a list of contacts from a colleague into his personal address book. The list of contacts is contained in
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!