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
Dafna11 [192]
2 years ago
6

Write a function which the counts the number of odd numbers and even numbers currently in the stack and prints the results.

Computers and Technology
1 answer:
Lerok [7]2 years ago
5 0

Answer:

See the code below and the algorithm explanation on the figure.

Explanation:

The explanation in order to get the answer is given on the figure below.

Solving this problem with C. The program is given below:

#include <stdio.h>

int main(void) {

   int n, Even=0, Odd=0, Zeros=0;  

   for (;;) {

       printf("\nEnter the value the value that you want to check(remember just integers): ");

       //IF we input a non-numeric character the code end;

       if (scanf("%d", &n) != 1) break;

       if (n == 0) {

           Zeros++;

       }

       else {

           if (n % 2) {

               Even++;

           }

           else {

               Odd++;

           }

       }

   }  

   printf("for this case we have %d even, %d odd, and %d zero values.", Even, Odd, Zeros);

   return 0;

}

You might be interested in
If Johanna wants to label the x- and y-axes in Excel she should click Layout, then what?
denis-greek [22]
<span> If Johanna wants to label the x and y axes in an Excel chart, she should click anywhere on the chart, then click on the Layout tab. Under Labels, she should click on Axis Titles, and select the Secondary Horizontal Axis Title for x axis or <span>Secondary Vertical Axis Title for y axis. She should then select the text that is in the Axis Title box, and type the title name that she wants.</span></span>


6 0
3 years ago
Do earthquakes ever happen in Malaysia?​
adoni [48]

The correct answer to this open question is the following.

Although there are no options attached we can say the following.

Do earthquakes ever happen in Malaysia?

Yes, they do. And they are very frequent and high in intensity.

For instance, the Sabah earthquake in 2015.

On June 5, 2015, the region of Malaysia was hit by a strong earthquake, 6.0 of magnitude on the Ritcher scale. The telluric movement lasted 30 seconds and caused much destruction.

Experts and scientists confirm that this had been the strongest earthquake since the one presented in 1976.

8 0
3 years ago
Which two editions of Windows 7 support 64 bit CPUs? Choose two out of Professional, Business, Starter, or Home Premium.
Tju [1.3M]
Home premium, professional
6 0
3 years ago
What is the on board storage C:
sasho [114]
On-board? im assuming so. an on-board storage is where people keep luggage/items on a ship.

hopefully i could help ;)
7 0
3 years ago
You are to calculate the property tax for tax payers. You will ask the county tax clerk if they want to run the program and init
andre [41]

Answer:

Explanation:

The following code is written in Java. It creates the loop as requested and validates the information provided before continuing, if the information is invalid it prints "Invalid Information to the screen" and asks the user to enter the information again. Finally, outputing all the requested information at the end of the program. The code has been tested and the output can be seen in the attached image below.

import java.util.ArrayList;

import java.util.Arrays;

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       int totalValues = 0;

       int totalTaxes = 0;

       int count = 0;

       while(true) {

           int lotNumber, value;

           double tax;

           System.out.println("Would you like to add an Entry: 1=Yes 0=No");

           int answer = in.nextInt();

           if (answer == 1) {

               System.out.println("Please enter lot number: ");

               lotNumber = in.nextInt();

               if ((lotNumber >= 0) && (lotNumber <= 999999)) {

                   System.out.println("Please enter assessed value: ");

                   value = in.nextInt();

                   tax = value * 0.05;

                   System.out.println("Lot Number: " + lotNumber);

                   System.out.println("Property Value: " + value);

                   System.out.println("Property Tax: " + tax);

                   totalTaxes += tax;

                   totalValues += value;

                   count += 1;

               } else {

                   System.out.println("Invalid Lot Number");

               }

           } else {

               break;

           }

       }

       int average = totalTaxes / count;

       System.out.println("Total Property Values: " + totalValues);

       System.out.println("Total Property Taxes: " + totalTaxes);

       System.out.println("Average Property Tax" + average);

   }

}

8 0
2 years ago
Other questions:
  • What development in operating systems happened between the years 1990 and 2000?
    15·1 answer
  • Which of the following is true of information systems?
    15·1 answer
  • 2. Which Interface uses
    7·1 answer
  • Select one of the wrong answer from question 1 and explain why it is ironic.
    7·1 answer
  • ____ Is an Internet service that allows users to send and receive short text messages In real time.
    10·1 answer
  • Which role will grant a delegate read-only access to a particular workspace within a user’s Outlook mailbox?
    15·2 answers
  • Which of these five are Netflix Originals?1/5
    5·1 answer
  • You learned that "The CPU interacts with memory in a process that is known as
    6·1 answer
  • A small network that consists of devices connected by Bluetooth, such as a smartphone and a computer, is referred to as a ______
    14·1 answer
  • True or false. windows server standard edition supports software-defined networking
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!