You are given two sorted arrays (all elements are in ascending order). You need to merge these
two arrays such that the initial numbers (after complete sorting) are in the first array and the
remaining numbers are in the second array.
Write a C++ program.
Dynamically allocate a 1D integer array of size n. Populate it with random numbers from 1 to
99.
Display the array in main function. Pass it to a void function difference() along with a variable
‘diff’ by reference.
The function displays the highest and the lowest element in the array and calculates the
difference between the highest and the lowest element and return it to the main function using
the variable passed where it is displayed.
You are given two sorted arrays (all elements are in ascending order). You need to merge these
two arrays such that the initial numbers (after complete sorting) are in the first array and the
remaining numbers are in the second array.
An array my_Array[] consisting of ‘a’ s, ‘b’ s and ‘c’s. The task is to write a function that arranges the array such that all ‘a’s are placed first, then all ‘b’s and then all ‘c’s in last.
Miss Nosheen is a kindergarten teacher and is teaching numbers to her pupils. She wants to allow her students to be able to immediately verify the results of their answers to the problem of finding out the digits in a number. Write a program which can take a number and show the number of digits it contains.
Jazmin encountered a problem in his mathematics class. His teacher announced that if any positive integer is equal to the sum of its proper positive divisors, i.e., the sum of its positive divisors excluding the number itself, such a number is called a perfect number. He told them to write fifty examples for such numbers. Ali understands that to find fifty examples will waste a lot of time, instead he will have to come up with a more efficient way to implement this. Help Ali implement such a system through your program.
Zyan wants to allow visitors of his new website to input and send the bid amounts of antiques shown. He likes to not let them send him any amount less than the base amount he set of Rs.5000. He thinks that the user should have to write the amount again until they write the right amount. Help Adeel setup such a system.
Jonathan is competing to be the class CR on a voting basis. Write a program to help count the number of positive and negative votes he received. The program should terminate if a student enters 0 instead of n or p.
Sample:
Enter your choice(p/n): p
Enter your choice(p/n): p
Enter your choice(p/n): n
Enter your choice(p/n): n
Enter your choice(p/n): p
Enter your choice(p/n): 0
The positive votes are: 3
The negative votes are: 2
Write a program to print the names of students by creating a Student class. If no name is passed while creating an object of Student class, then the name should be "Unknown", otherwise the name should be equal to the String value passed while creating object of Student class.
Take an array of size 5x5 and initialize it with random numbers of range 1 to 10, now add all the elements of the 2D array and display sum.
Modify part a in such a way that you have to find individual sum of each row of the 2D array and store corresponding result in 1D array i.e. sum of all the elements of row 0 should be stored in 1st element of 1D array, similarly sum of all elements of the second row of 2D array should be stored at the second
index of 1D array. Display the final sum array (i.e. 1D array). Think about the size of 1D array yourself.
Example:
Array:
2 3 5 3 1
4 5 1 2 1
4 7 3 2 0
2 1 1 5 1
1 7 8 9 0
Sum array:
14 13 16 10 25
Perform sum of all the elements of the arrays whose row number and column number both are odd. Display the final sum.
Array:
2 3 5 3 1
4 5 1 2 1
4 7 3 2 0
2 1 1 5 1
1 7 8 9 0
Sum: 13