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]
3 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]3 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
Is a MODEM required for Internet Connectivity ?<br> Yes<br> No
Pie

Answer:

you can connect to the wifi on your device it will say you are connected but the wifi will not be connected to the internet so you will be able to do nothing on it without the modem

Explanation:

4 0
2 years ago
Read 2 more answers
What are barcode and rfid tags ​
Solnce55 [7]

Answer:

They are both ways to identify assets (e.g., persons, animals, objects).

Explanation:

A barcode is a bit of information (usually a number) printed as a line or block pattern on a surface (e.g., a sticker).

An RFID is a bit of computer memory with an antenna.

Both can be read with the appropriate scanner device.

7 0
3 years ago
Read 2 more answers
Write a program that declares and initializes a variable representing the weight in milligrams from the keyboard. The program di
Burka [1]

Answer:

weight = int(input("Enter weight in milligrams: "))

kilograms = int(weight / 1000000)

grams = int((weight - (kilograms * 1000000)) / 1000)

milligrams = weight - ((kilograms * 1000000) + (grams * 1000))

print("{} milligrams are equivalent to {} kilogram(s), {} gram(s), and {} milligram(s)".format(weight, kilograms, grams, milligrams))

Explanation:

*The code is in Python.

Ask the user to enter the weight and set it to the variable weight

Calculate the kilograms, divide the weight by 1000000 and cast the result to the int (If the weight is 1050042, kilograms would be 1050042/1000000 = 1)

Calculate the grams, subtract the kilograms from the weight, divide it by 1000 and cast the result to the int (If the weight is 1050042, grams would be int((1050042 - (1 * 1000000)) / 1000) = 50)

Calculate the milligrams, subtract the kilograms and grams from the weight (If the weight is 1050042, milligrams would be 1050042 - ((1 * 1000000) + (50 * 1000)) = 42)

Print the weight, kilograms, grams, and milligrams in the required format

3 0
3 years ago
Which option describes wearable technology?
kotykmax [81]
My opinion is the answers A and D. I would choose A if you can only choose one, though.
7 0
3 years ago
Read 2 more answers
The ease of travel in the twentieth century played a role in the advancement of medicine. Based on this lesson, which statement
Shtirlitz [24]
During the twentieth century, transportation had been very significant and played a great influence in the advancement of medicine. This is because this made health care become more accessible to patients no matter where they are located. The answer for this would be option C.
8 0
3 years ago
Read 2 more answers
Other questions:
  • Jason is creating a webpage on the basic parts of a camera. He has to use a mix of both images and content for the web page to h
    11·1 answer
  • What does a sharp sign indicate when used in representing a pitch?
    10·1 answer
  • Most presentations use text: A. To maximize area and style. B. At a minimum. C. To draw attention to content. D. Without restrai
    9·2 answers
  • During prereading, it is not important to pay attention to visual aids.<br> T f
    15·2 answers
  • If a computer is not working properly,the best thing to do is ________?
    5·2 answers
  • You have just finished upgrading the 250 w power supply in your desktop computer to a 450 w power supply. now the bios doesn't r
    7·1 answer
  • Should the use of hacktivists by a country against enemy organizations be considered an act of war? Why or why not? How about th
    8·1 answer
  • What is the turns ratio of the transformer T10261
    5·1 answer
  • Which of the following best describes a balanced reaction
    11·1 answer
  • Which directory contains the initrd file? in suse linux
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!