#include <stdio.h>
void mod3_arr(int* arr1);
int main()
{
int arr[10], i;
for (i = 0; i < 10; i++)
{
printf("Input the %d element of array :: ", i);
scanf("%d", &arr[i]);
}
printf("The elements of the array are :: ");
for (i = 0; i < 10; i++)
{
printf("%d ", arr[i]);
}
printf("\n");
mod3_arr(arr);
return 0;
}
void mod3_arr(int* arr1)
{
int i = 0, j = 0, arr2[10];
for (i = 0; i < 10; i++)
{
if ((arr1[i]%3) == 0) {
arr2[j] = arr1[i];
j++;
}
}
int count = j;
printf("The element of array which is mod3 numbers are :: ");
for (j = 0; j < count; j++)
{
printf("%d ", arr2[j]);
}
printf("\n");
}
/********************** OUTPUT OF PROGRAM ***************************
>> ./a.out
Input the 0 element of array :: 10
Input the 1 element of array :: 20
Input the 2 element of array :: 15
Input the 3 element of array :: 30
Input the 4 element of array :: 45
Input the 5 element of array :: 40
Input the 6 element of array :: 50
Input the 7 element of array :: 59
Input the 8 element of array :: 72
Input the 9 element of array :: 98
The elements of the array are :: 10 20 15 30 45 40 50 59 72
98
The element of array which is mod3 numbers are :: 15 30 45 72
*****************************************************************************/
versity of Debrecen, Faculty of Engineering Mechatronics Department 4. Prepare a C Like function, what is...
Programming Fundamental (C++) Lab C++ Lab Ra'fat Amareh Faculty of Engineering and Information Technology Assignment Write a C++ program that performs the following: Prints on screen a selection menu as follow: a. Sin (x), Series b. Sum odd digit, Print Digits, Print Shape c. Array d. Exit If user presses a or A, the following sub menu should be displayed 1- Sin (x) (Program should solve the following series x - x'/3! + x®/5! – x/7...x"m!) 2- F (Program should...
C++ Programming 1. Write a function (header and body) that accepts an integer as an argument and returns that number squared. 2. Write the code that will fill an integer array named multiples with 10 integers from 5 to 50 that are multiples of five. (This should NOT be in the form of an initialization statement.) 3. Write the code that will display the contents of the integer array named multiples. Recall: the size of the array is 10. 4....
Please give a detailed explanation.
5. An Economic Department at a state university with five faculty members - Anderson, Box, Cox, Carter, and Davis - must select two of its members to serve on a program review committee. The representative will be selected by putting five slips of paper in a box, mixing them, and selecting two What is the probability that both Anderson and Box will be selected? What is the probability that at least one of the two...
4. The engineering department has estimated your firm's cost function to be TC(O) = 5,000 + Q-Q? + Q: 13 This cost function has a marginal cost function MC(Q) = 1 -2Q+Q? a. Is this your long run or short run cost function? b. How much will it cost to produce 100 units? c. What is the average cost of 100 units? d. What is the marginal cost of the 100th unit? e. At what quantity is minimum average variable...
C- PROGRAMMING PROJECT #4 Design and Write a C program to calculate an average of an array of numbers and produce the following output: 1. Your first and last name 2. Course Number 3. C Project Number 4. All the numbers in the array 5. The sum of all the numbers in the array 6. The count of all the numbers in the array 7. The average of all the numbers in the array Double-space after lines 3, 4, 5,...
1. Write a C function named find that receives a one-dimensional array of type integer named arr and its size of type integer. The function fills the array with values that are the power of four (4^n) where n is the index. After that, the function must select a random index from the array and move the array elements around the element stored in the randomly selected index Example arr = [1, 4, 16, 64, 256) if the randomly selected...
4. Write a C program that will perform the following: a. In the main program enter 2 integer numbers. If the first number is less than the second number call the function happy(). Otherwise give a warning message that the function is not performed. b. Define a function happy() that will request from the user to enter 10 integer numbers to one dimensional array A. The function will find and return how many numbers are above 5.
17.9 Worksheet 7 (C++) Follow the instructions commented into the given template. int main() { int array1[20] = {3, 18, 1, 25, 4, 7, 30, 9, 80, 16, 17}; int numElements = 11; cout << "Part 1" << endl; // Part 1 // Enter the statement to print the numbers in index 4 and index 9 // put a space in between the two numbers cout << endl; // Enter the statement to print the numbers 3 and 80...
1. Print out information of PHP use phpinfo() function. 2. Write a program that check and print odd / even numbers (from number 1 to 100 using for/while loop). Display the results within an HTML table with 2 columns as shown below: NUMBERS RESULTS 1 ODD 2 EVEN 3 ODD HINT: use <table> tags to create a table, <th> tags for ‘Numbers’ and ‘Results’. Wrap code PHP inside HTML code. For example: <html> <title>CHECK ODD or EVEN</title> <body> <table> <?php...
The percentage of students in four different faculty departments A, B, C and D are 40%, 30%, 20%, and 10% respectively. If you know that 80%, 85%, 87%, and 90% of each department students have passed last exam, what is the probability that a randomly selected student has passed the exam. (SMarks) . How many different ways can 3 red. 4 yellow, and 2 blue bulbs be arranged in a string of a ll. Suppose that a random variable X...