programming question
programming question
programming question
Define a function which receives a number as argument and returns 1 if the number is prime
otherwise returns 0. Use this function in main function to display all prime numbers between
two numbers.
2. Write a program which asks order of two matrices and read two matrices of given order.
Subtract second matrix from first and display the resultant matrix.
3. Write a program to read a string from user and reverse it without using string related library
function.
4. Write a program that determine the largest of three numbers using pointer.
5. Write a program to read 10 numbers and reorders them in ascending order. Define separate
function for reading , sorting and displaying array elements.
6. Define two functions getArraynum() to read an array from user and determine the greatest
number respectively. Write main program to declare as floating point type array of size 10 and
pass this array to first function getarraynum() to read its elements and then pass the same array
to another function greatestnum() to determine the greatest number among elements of the
array.
7. Create a structure named student that has name, roll, marks and remarks as members. Assume
appropriate types and size of member. Use this structure to read and display records of 4
students. Create two functions: one is to read information of students and other is to display the
information. Pass array of structure to these functions.
8. Define a class named distance with meter and cm as private data members and appropriate
function members. Use this class to read two objects of the distance class , add them by passing
these two objects to a function members and finally display result object in main() function.
9. Define a class shape with dim1 and dim2 as private members. Create two constructors of the
class, one with one argument and other with two arguments. Write a main() program to define
object rectangle with two dimensions and another object square with only one dimension using
appropriate constructor and calculate their area.
9