Write a C program with a filename netID_intarray.c that has 2 arrays. One is a two-dimensional array of strings which contains 5 words, each word can be a max of 20 characters long. The list of strings should be static in your code. The second integer array is populated by prompting the user for 10 integers to be stored in the array.
Here is the simple output:
$ ./run Number Work Enter integer 1 for the array: 45 Enter integer 2 for the array: 21 Enter integer 3 for the array: 22 Enter integer 4 for the array: 2 Enter integer 5 for the array: 3 Enter integer 6 for the array: 8 Enter integer 7 for the array: 5 Enter integer 8 for the array: 3 Enter integer 9 for the array: 5 Enter integer 10 for the array: 65 The sum of the integers in the array is 179. The integer average is 17. There are 3 even integers and 7 odd integers. Word Game Guess a word in the list: hi The word "hi" was not in the list. The words in the list were: hello pumpkin two numbers watermelon $./run Number Work Enter integer 1 for the array: 6 Enter integer 2 for the array: 1 Enter integer 3 for the array: 54 Enter integer 4 for the array: 77 Enter integer 5 for the array: 8 Enter integer 6 for the array: 9 Enter integer 7 for the array: 1 Enter integer 8 for the array: 2 Enter integer 9 for the array: 3 Enter integer 10 for the array: 6 The sum of the integers in the array is 167. The integer average is 16. There are 5 even integers and 5 odd integers. Word Game Guess a word in the list: pumpkin You guessed right!! The list has pumpkin!! The other words in the list were: hello two numbers watermelon
Requirements
Please help me with these problem ASAP, I would upvote your answer!
C code:
#include <stdio.h>
#include<string.h>
int main()
{
int a[10]; //declaring integer array
char str[5][20]; //declaring strings array
char word[20];
int c=0,d=0;
strcpy(str[0],"hello"); //initiaizing strings array elements
strcpy(str[1],"pumpkin");
strcpy(str[2],"two");
strcpy(str[3],"numbers");
strcpy(str[4],"watermelon");
int sum=0, average, even, odd;
printf("Number Work\n");
for(int i=0;i<10;i++)
{
printf("Enter integer %d for the array: ",i+1); //prompting user to
enter array number
scanf("%d",&a[i]); //scanning array number
}
printf("\n");
for(int i=0;i<10;i++)
{
if(a[i]%2==0) //checking if the number is even
even++;
else
odd++;
sum=sum+a[i]; //calculating sum
}
average=sum/10; //calculating average
printf("The sum of the integers in the array is %d.\n",sum);
//printing sum
printf("The integer average is %d.\n",average); //printing
average
printf("There are %d even integers and %d odd
integers.\n",even,odd); //printing number of even and odd
numbers
printf("\n");
printf("Word Game\n");
printf("Guess a word in the list: "); //prompting user to enter a
word
scanf("%s",&word); //scanning a word
printf("\n");
for(int i=0;i<5;i++)
{
if(strcmp(str[i],word)==0) //checkimg if the word is present in the
string array
{
d=1; //if the word is present in the string array, making d=1
break;
}
else
{
c++; //incrementing c if the word is not present in the string
array
}
}
if(d==1)
{
printf("You guessed right!! The list has %s!!\n",word); //printing
the statement if the user guess is correct
printf("The other words in the list were:");
for(int j=0;j<5;j++)
{
if(strcmp(str[j],word)!=0)
printf(" %s",str[j]); //printing the remaining words in the string
array
}
}
if(c==5)
{
printf("The word %s was not in the list.\n",word); //printing the
statement if the user guess is correct
printf("The words in the list are:");
for(int i=0;i<5;i++)
{
printf(" %s",str[i]); //printing all the words in the string
array
}
}
return 0;
}


Output:

Write a C program with a filename netID_intarray.c that has 2 arrays. One is a two-dimensional...
Exercise 1 Write a program that asks the user to enter the seed for a random number generator. Then the program uses this seed to roll a dice and hence generates two integers corresponding to the faces of each dice. If their sum is odd, the user has two tries to guess the sum. The program gives the user a hint after the first try. Otherwise, the user has three tries to guess the sum. Sample run 1: Enter the...
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 Java program to prompt for inputting an integer N, then enter N integers (a loop is needed), print the numbers user entered, and the amount of even and odd numbers (zero is even number). (1) Prompt for the user to input an integer and output the integer. (1 pts) Enter an integer: You entered: 5 (2) Prompt for the user to input N integers, output the numbers entered and the amount of even and odd numbers (9 pts)...
Write a C program to do the following 1) request user to enter 10 integer into an array 2) sort the array in ascending order 3) display the sorted array 4) count the number of odd and even number in the array and print out the result 5) add the value of the odd number and even number and calculate the average of the odd and even number. display the result 6) write function addNumber() to add all the number...
(+30) Provide a python program which will Populate an array(list) of size 25 with integers in the range -100 (negative 100) to +100 inclusive Display the array and its length (use the len function) Display the average of all the integers in the array Display the number of even integers (how many) Display the number of odd integers (how many) Display the number of integers > 0 (how many) Display the number of integers < 0 (how many) Display the...
In C... Write a program to simulate a pick-5 lottery game. Your program must generate and store 5 distinct random numbers between 1 and 9 (inclusive) in an array. The program prompts the user for: an integer random seed five distinct integers between 1 and 9 (which are stored in another array) The program then compares the two arrays to determine if they are identical. If the two arrays are identical, then the user wins the game. otherwise the program...
In C program #include<stdio.h> Write a program to simulate a pick-5 lottery game. Your program must generate and store 5 distinct random numbers between 1 and 9 (inclusive) in an array. The program prompts the user for: an integer random seed five distinct integers between 1 and 9 (which are stored in another array) The program then compares the two arrays to determine if they are identical. If the two arrays are identical, then the user wins the game. otherwise...
python
la ab X, X Lab 7 Design and implement a Python program that uses a while loop and selection statements to print the sum of the even numbers and the sum of the odd numbers (all integers) read from the keyboard. The sequence of numbers ends with a negative number: So, all numbers considered for printing the two sums are greater than or equal to 0. The sequence may be empty. Here is a possible interaction. Enter an integer:...
C++
Write a program that prompts the user to enter integers or a sentinel to stop. The program prints the highest and lowest numbers entered, the sum and the average. DO NOT USE ARRAYS, only variables and loops. Write a program the prompts the user to input a positive integer. Keep asking the user until a positive integer is entered. Once a positive integer is entered, print a message if the integer is prime or not. (NOTE: A number is...
using matlab
In Class Exercises 8-Arrays For the following exercises, assume an array is already populated, your job is to write a program that traverses the array. DO NOT HARD CODE the last index. In other words, you code for 1-4&6 should be able to handle the following 2 arrays: amp2 10 array1 [52, 63, 99, 71, 3.1] array2 - [99:-3: 45); For 5: wordArray1 wordArray2 ('number, 'arrays', 'indices', 'hello', finish' [number, 'different, 'finish? 1. Determine the sum of all...