n = int(input("How many numbers do you need to check? "))
even = 0
odd = 0
for x in range(n):
num = int(input("Enter number: "))
if num % 2 == 0:
even += 1
print(str(num) + " is an even number.")
else:
odd += 1
print(str(num) + " is an odd number.")
print("You entered " + str(even) + " even number(s).")
print("You entered " + str(odd) + " odd number(s).")
This works for me. Best of luck.
Answer:
// Producer Thread
void *producer(void *param) {
buffer_item item;
while (true) {
item = rand() % 100;
sem_wait(&empty);
pthread_mutex_lock(&mutex);
if (insert_item(item))
printf("Can't insert item\n");
else
printf("Producer %d: produced %d\n", *((int*)param), item);
pthread_mutex_unlock(&mutex);
sem_post(&full);
}
}
// Consumer Thread
void *consumer(void *param) {
while (true) {
buffer_item item = NULL;
if (in > 0)
item = buffer[in - 1];
sem_wait(&full);
pthread_mutex_lock(&mutex);
if (remove_item(&item))
printf("Can't remove item\n");
else
printf("Consumer %d: consumed %d\n", *((int*)param), item);
pthread_mutex_unlock(&mutex);
sem_post(&empty);
}
}
Explanation:
An outline of the producer and consumer threads appears as shown above.
1. spreadsheet
2. Computers will continue to become smaller in size and become faster
Answer:
Task manager
Explanation:
Allows you to force quit applications.
Answer: Any person or people asking about someone being a hardware or software person displays that they are questioning about the computer knowledge of the person and his/her interest.
The interest can be regarding software tools for programming, designing , etc or hardware device like troubleshooting, assembling the computer parts ,etc.
The person persisting good knowledge about software programming language and software is diverted towards software side .The person who likes to deal with hardware parts of the computer system is hardware-oriented person.