Using an array , write a C++ program that can hold ten integer input from user. Display those values on the screen , and their prompt the user an integer to search within the array , and count the number of times the item is found.
Enter 10 values in array :
1
2
3
4
5
6
7
8
8
Values in array now : 1 2 3 4 5 6 7 8 8
Enter the value to find : 8
8 was found in 2 times.
____________________________
Process excited with return value 0
Press any key continue . . .
Enter a C++ program that will help accept an input for the array size. Store the user input then display the even odd numbers.
Enter array size :: 10
Enter array elements ::
Enter arr[0] Elements :: 1
Enter arr[1] Elements :: 2
Enter arr[2] Elements :: 3
Enter arr[3] Elements :: 4
Enter arr[4] Elements :: 5
Enter arr[5] Elements :: 6
Enter arr[6] Elements :: 7
Enter arr[7] Elements :: 8
Enter arr[8] Elements :: 9
Enter arr[9] Elements :: 0
Stored Data in Array ::
1 2 3 4 5 6 7 8 9 0
Events Elements in Array are ::
2 4 6 8 0
Odd Elements in Array are ::
1 3 5 7 9
Write a class marks with three data members to store three marks. Write three member functions, set_marks() to input marks, sum() to calculate and return the sum and avg() to calculate and return average marks.
Create a program that asks for the user to choose either to subtract two matrices or exit the program. If the user inputs a choice that is not among the choices given, then the program’s screen will clear and display the main menu again.
For the first menu item, the program must be able to get the number of rows and columns of the two matrices. The dimensions (row x column) of the two matrices must be of the same size before asking the user for the values of each matrices.
If the dimensions do not match, then the program will display this:
WHEN SUBTRACTING MATRICES, THE DIMENSIONS OF BOTH MATRICES MUST MATCH.
MATRIX 1 - MATRIX 2 = DIFFERENCE MATRIX. THE MATRIX DIMENSIONS ARE VARIABLE, MEANING THE USER WILL INPUT THE DIMENSIONS THEY WANT FOR THE TWO MATRICES.
Once the program gets the values of each matrix, it will display the two matrices and it’s resulting Difference Matrix:
Write a C++ program for Addition, multiplication, subtraction, division of two pointer
variable which has the address of another variable.
:Calculate the sum of all elements in given matrix.
44 85 20 33 -18
56 35 67 -2 -54 45
44 42 56 -76 90
-56 78 -14 79 11 33 in java
Write a program that will ask user to enter a digit character (i.e. ‘0’ or ‘1’ .... or ‘9’). If user enters a non-digit character then the program should display message to re-enter correct input. If user enters a correct character (i.e. a digit character) then your program should convert that character to a same digit but in integer type. Do this for five inputs. Finally, add all digits and display their sum. Do not use any library function or loops.
Example:
Enter a digit-character: 8 (please note that this is to be stored in char variable)
Enter a digit-character: 6
Enter a digit-character: 0
Enter a digit-character: +
Wrong character. Please enter again.
Enter a digit-character: 2
Enter a digit-character: 7
Sum of digits is 23.
Question 9
print("Original array:")
Answer:
print(x)
>>>array([ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])
print(“Remove even numbers from the array x: “)
Answer:
print(x)
>>>array([12, 14, 16, 18, 200])
print(“Replace all odd numbers in array x with -10:”)
Answer:
print(x)
>>> array([ 12, -10, 14, -10, 16, -10, 18, -10, 20])
Question 10
print("Original array:")
Answer:
>>> print(X)
[10 12 14 16 18 20 22 24 26 28 30]
>>> print(Z)
[10 12 14 16 18 20 22 24 26 28 30]
Answer:
>>> print(X)
[0 2 4 6 18 20 22 24 26 28 30]
Answer:
>>> print(Z)
[10,12,14,16,-18,-20,-22,-24,26,28,30]
Question 7
X = np.array([
[10,20,30],
[40,50,60],
[70,80,90]])
Answer:
print(X)
array([20, 50, 50])
Question 8
Y = np.array([
[3,6,9,12],
[15,18,21,24],
[27,30,33,36],
[39,42,45,48],
[51,54,57,60]])
Answer:
Question 8 Output
array([[ 3, 12],
[27, 36],
[51, 60]])