Write a C program which takes 5 numbers from the user.
Write a switch case to find out
how many numbers are even
#include<stdio.h>
void main()
{
int a[5],i,count_even=0,count_odd=0;
printf("\n\nEnter any five numbers: ");
for(i=0;i<5;i++)
{
scanf("%d",&a[i]); // reading five numbers from the
keyboard
}
for(i=0;i<5;i++)
{
switch(a[i]%2) // logic begins ere
{
case 0: // case matches when switch variable remainder is 0
count_even++;
break;
case 1: // case matches when switch variable remainder is 1
count_odd++;
}
}
printf("Number of even numbers in the given list of numbers are
%d",count_even);
printf("\nNumber of odd numbers in the given list of numbers are
%d",count_odd);
}
Screenshots:


Output:

Write a C program which takes 5 numbers from the user. Write a switch case to...
Write a C++ program that prompts the user to enter two numbers. Then prompt the user to select from the following options: a. Add the numbers. b. Multiply the numbers. c. Terminate the program Use the appropriate control structures (loops, if else, switch-case, etc) to make your program as short and efficient as possible. Minor syntax errors are forgiven in this exercise; just focus on the correct structure, declarations and sequence of instructions
LANGUAGE = C i. Write a program that takes int numbers from user until user gives a sentinel value (loop terminating condition). Sort the numbers in ascending order using Insertion sort method. Sorting part should be done in different function named insertionSort(). Your code should count the number of swaps required to sort the numbers. Print the sorted list and total number of swaps that was required to sort those numbers. (4 marks) ii. In this part take another number...
using c++ write a program that reads numbers from the user until the user enters a Sentinel. Use a Sentinel of -999. Ignore all negative numbers from the user input. Do the following: 1. Output the sum of all even numbers
using c++ write a program that reads numbers from the user until the user enters a Sentinel. Use a Sentinel of -999. Ignore all negative numbers from the user input. Do the following: must use loops and numbers to do this 1. Output the sum of all even numbers 2. Output the sum of all odd numbers 3. Output the count of all even numbers 4. Output the count of all odd numbers
Write a program which asks the user to enter an integer. Use switch statement to write out the numeric word (such as ONE) if the user's input is 1; (see the sample run output for the usr input 2 or 3); otherwise, write OUT OF RANGE. Below are few sample runs: If the user enters a 1, the program will print: ONE TWO THREE Or, if the user enters a 2, the program will print: TWO THREE Or, if the...
. Write a program that takes integers from the user one at a time. Assume the input is some number of positive integers. The user will type in 0 to end the input and the 0 should not be counted as input. Your program should find how many times the user enters a multiple of 5 and then print it to the screen. If the input is 6 10 30 5 0, the output is 3 because 10, 30, and...
Write a c++ complete program to meet the specifications. The program should prompt the user for a positive integer. The program should print a message whether the integer is even or odd. The looping should end when the user enters a negative number. The negative number will not be tested for even or odd. The program will print out a message of how many numbers were entered (not counting the negative number) and how many even and odd numbers were...
Write a program that takes a list of integer numbers from a user and creates a new sorted in ascending order list. As output you need to print original list and sorted one. use list and while python
5. Write a program in, "Python" that reads 2 numbers from the user. The program should then print out whether the first number is evenly divisible by the second number.
// Program takes 5 numbers from a user (from console), stores them into an // array, and then prints them to the screen (on the same line). // Add code to complete this program. You only need to add code where indicated // by "ADD HERE". #include <iostream> using namespace std; int main() { const int SIZE = 5; // size of array // ADD HERE - create an array of integers that will hold 5 integers. cout << "please...