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
egoroff_w [7]
2 years ago
12

write a program in C# that reads a set of integers and then finds and prints the sum of the even and odd integers?​

Computers and Technology
1 answer:
trapecia [35]2 years ago
5 0

Answer:

The program in C# is as follows:

using System;

class Prog {

 static void Main() {

   int n;

   Console.WriteLine("Number of integers: ");

   n = Convert.ToInt32(Console.ReadLine());

   int evensum = 0, oddsum = 0; int inpt;

   for(int i = 0;i<n;i++){

       inpt = Convert.ToInt32(Console.ReadLine());

       if(inpt%2==0){            evensum+=inpt;        }

       else{            oddsum+=inpt;        }

   }

    Console.WriteLine(evensum);

    Console.WriteLine(oddsum);

 }

}

Explanation:

This declares n, the number of integer inputs

   int n;

This prompts for n

   Console.WriteLine("Number of integers: ");

This gets input for n

   n = Convert.ToInt32(Console.ReadLine());

This declares and initializes the even and odd sum.

   int evensum = 0, oddsum = 0; int inpt;

This iterates through n

   for(int i = 0;i<n;i++){

This gets each input

       inpt = Convert.ToInt32(Console.ReadLine());

Check for even numbers and add,if even

<em>        if(inpt%2==0){            evensum+=inpt;        }</em>

Otherwise, add input as odd

<em>        else{            oddsum+=inpt;        }</em>

   }

Print even sum

    Console.WriteLine(evensum);

Print odd sum

    Console.WriteLine(oddsum);

 }

You might be interested in
What is a command-line interactive scripting environment that provides the commands for almost any management task in a Windows
hoa [83]

Answer:

kqwbxskwsxe

Explanation:

menb dhj

8 0
3 years ago
9) If you are working on the part of 5-15 minutes, time-stamping (every 30 seconds) should start at: a) [00:05:00] b) [00:00:00]
loris [4]

Answer:

a) [00:05:00]

Explanation:

Timestamps are markers in a transcript which are used to represent when an event took place. Timestamps are in the format [HH:MM:SS] where HH is used to represent hour, MM to represent the minute and SS to represent the seconds. They are different types of timestamping such as:

i) Periodic time stamps: Occurs at a consistent frequency

ii) Paragraph time stamping: At the beginning of paragraphs

iii) Sentence time stamp: at the beginning of sentence

iv) Speaker time stamp: at change of speaker.

Since a part of 5-15 minutes with time-stamping (every 30 seconds), The time stamping should start at 5 minute [00:05:00] and end at [00:15:00]. This is a periodic time stamp since it occurs every 30 seconds, this means the next time stamp would be [00:05:30] and this continues until 15 minute [00:15:00]

3 0
3 years ago
9. Question
Gennadij [26K]
A server stopped provide service to 100 users
5 0
2 years ago
Write a Python function that takes a positive integer N and returns the factorial of N, i.e., N! The factorial of N, denoted N!,
sesenic [268]

Answer:

The python function is as follows:

def fact(N):

   factorial = 1

   for i in range(1,N+1):

       factorial = factorial * i

   return(factorial)

Explanation:

This line defines the function

def fact(N):

This line initializes the product of 1 to N to 1

   factorial = 1

This line iterates through 1 to N

   for i in range(1,N+1):

This line calculates the product of 1 to N i.e. factorial

       factorial = factorial * i

This line returns the factorial

   return(factorial)

6 0
2 years ago
How many times is the coin tossed?
valina [46]

Answer:

100 times.

Explanation:

The code will loop until i is equal to or greater than roles. I starts at zero and increases by one after each toss.

3 0
2 years ago
Read 2 more answers
Other questions:
  • All of the following are types of data storage devices except CD/DVD computer monitor digital cameras flash drive
    15·1 answer
  • What is client server relationship is the basic form of what
    6·1 answer
  • Question 2 (5 points)
    12·1 answer
  • What is the first thing you should do when troubleshooting a computer problem
    5·2 answers
  • 14. Blender® does not typically use pop-up boxes. (1 point)
    7·1 answer
  • Donna often travels around the world. When she travels, she needs to access her emails from different locations. However, to kee
    6·2 answers
  • What are some positive impacts technology has on the environment?​
    5·2 answers
  • Which of the following expressions in Java is equal to 4?
    11·1 answer
  • You can enter common data in multiple worksheets by __________.
    14·2 answers
  • Scripting languages are unique computer languages with a specialized function. explain what scripting languages do, and how this
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!