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
A presentation software that is used to organize and present pertinent information using graphics, word processing, outlining, d
lesantik [10]

Answer:

C

Explanation:

Well, in your inquiry it says

"A presentation software that is used to organize and present pertinent information using graphics, word processing, outlining, drawing, and presentation management tools"

We know it isn't Microsoft Word, because Microsoft Word doesn't have a presentation feature. We know it isn't Excel because Excel is only meant for spreadsheet and analytics data.

However, on PowerPoint all these points make sense, PowerPoint is a tool that Microsoft created for the capabilities such as to present information, you can also put information inside of graphics as well, you can also draw, and outline too.

5 0
3 years ago
Write a program using integers userNum and x as input, and output userNum divided by x four times. Ex: If the input is: 2000 2
STatiana [176]

Answer:

// here is code in c++.

// include header

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

// variables to read input

   int userNum,x;

   cout<<"enter the value of userNum and x :";

   // read the input from user

   cin>>userNum>>x;

   // divide the userNum with x 4 times

   for(int a=0;a<4;a++)

   {

       userNum=userNum/x;

       cout<<userNum<<" ";

   }

       cout<<endl;

return 0;

}

Explanation:

Declare two variables "userNum" and "x". Read the value of these. Run a for loop 4 time and divide the "userNum" with "x" and print  the value of "userNum".

<u>Output:</u>

enter the value of userNum and x :2000 2                                                                                  

1000 500 250 125  

3 0
3 years ago
The security administrator for Corp wants to provide wireless access for employees as well as guests. Multiple wireless access p
Artemon [7]
It’s B I took the test
7 0
3 years ago
A(n) ________________ takes place when an unauthorized person gains access to a digital device by using an internet connection a
nordsb [41]
It's called an attack
4 0
3 years ago
You've formatted the first paragraph of a document. What button can you use to apply the formatting from the first paragraph to
julia-pushkina [17]
All formatting for a paragraph is stored in the paragraph mark and carried to the next paragraph when you press the Enter<span> key. </span>
6 0
3 years ago
Other questions:
  • Programming CRe-type the code and fix any errors. The code should convert non-positive numbers to 1.
    12·1 answer
  • How do you determine latitude using an astrolabe?
    11·1 answer
  • 10. Question
    15·1 answer
  • When did the mantle of the earth form
    14·2 answers
  • Which statement will properly start the main() function? def main(): def Main def main# def main[]
    14·2 answers
  • What is a collection of computer programs that administer the hardware and software of a computer so that they work properly?
    7·1 answer
  • You are a desktop administrator for nutex corporation. Your organization uses ethernet cable to connect network resources. A use
    14·1 answer
  • What can be the maximum possible length of an identifier 3163 79 can be of any length​
    5·1 answer
  • Que significa el término “Informática”?
    11·1 answer
  • . Imagine that you were programming without an IDE. What problems might you encounter?​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!