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
Write a program that would determine the day number in a non-leap year. For example, in a non-leap year, the day number for Dec
SOVA2 [1]

Answer:

In Python:

months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]

daymonths = [31,28,31,30,31,30,31,31,30,31,30,31]

day = int(input("Day: "))

month = input("Month: ")

ind = months.index(month)

   

numday = 0

for i in range(ind):

   numday+=daymonths[i]

numday+=day

print(numday)    

Explanation:

This initializes the months to a list

months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]

This initializes the corresponding days of each month to a list

daymonths = [31,28,31,30,31,30,31,31,30,31,30,31]

This gets the day from the user

day = int(input("Day: "))

This gets the month from the user

month = input("Month: ")

This gets the index of the month entered by the user

ind = months.index(month)

This initializes the sum of days to 0

numday = 0

This adds up the days of the months before the month entered by the user

<em>for i in range(ind):</em>

<em>    numday+=daymonths[i]</em>

This adds the day number to the sum of the months

numday+=day

This prints  the required number of days

print(numday)    

<em>Note that: Error checking is not done in this program</em>

7 0
3 years ago
2. Write a program to calculate CGPA of a student. The program should be able to get input from the user of the grade for each c
Irina18 [472]
The easy way to do it is to let an array accept all the inputs and add all the inputs together and divide the sum by how many the input was. 

Example : five + five + five + five + three + two = 25
Now divide twenty five : twenty five / six = 4.1

Letter A is the closest answer.
7 0
3 years ago
What is used to give credit to the source from which information is obtained?
Sati [7]
The Answer is (A) because a citation gives credit to the sources from which your information was obtained. Linkage has nothing to do with it... Plagiarism is the exact opposite of that.... And a format is just a way something is in order or arranged.
8 0
3 years ago
What is one of the main sustainability benefits of using large-scale, cloud computing data centers?
uysha [10]

Cloud computing allows for large chunks of data to be stored in data centers with owners having the ability to access stored information from any devices or location using their login credentials ensuring information are safe, secure and available over a an infinitely long period of time.

  1. Sustainability involves keeping hold of something over a very long period of time.

  • When data or information are saved on online data centers which is made possible by cloud computing. Cloud computing ensures that data isn't saved on an individual's personal memory storage such as local hard drive or memory Cards where it could be lost at anytime.

  • Data is stored online in data centers where it can be accessed over a very long period of time.

Therefore, the ability to get hold of time long information is an essential and important sustainability benefit offered by cloud computing.

Learn more :brainly.com/question/24875533

8 0
3 years ago
Creating an application for an ice cream shop. Create an interface named Flavor. Create three subclasses Lemon, Mint, and Chocol
Tpy6a [65]

Answer:

I don't know for sure what the answer is but I hope you can find someone that can give you the answer sorry!

Explanation:

6 0
2 years ago
Other questions:
  • A digital footprint is all of the information on-line about a person posted by that person or others, ____________. intentionall
    14·1 answer
  • Why is it important to begin development of a software solution with a programming design in place? A programming design summari
    11·2 answers
  • WILL UPVOTE &lt;3
    9·1 answer
  • What is a well-planned strategy that ensures the search and navigation functions are easy to use and user-friendly on a website?
    15·1 answer
  • Suppose you have a program P and 90 percent of P can be parallelized, but 10 percent of P is inherently sequential and cannot be
    10·1 answer
  • When measuring processor speed,a megahertz is much faster than a gigahertz.true or fals
    12·1 answer
  • Discuss how 3D modeling enhances animation.
    13·1 answer
  • Which function works best when you need to remove an element at a specific index in a list?
    11·1 answer
  • Where does blood travel when it leaves the right ventricle of the heart
    11·2 answers
  • Pls help me po:{<br><br> I need the answer lang po talaga , pls:{
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!