Você está na página 1de 3

Chapter -Array

Q1: Write a program that inputs ten integers in an array and counts all prime numbers entered by the user. The program finally displays total number of primes in array. Q2: Write a program that uses two arrays to store the roll number and marks of student. It inputs roll number and marks of five students and stores them in corresponding elements of the arrays (for example, if roll number 1 is stored in rno[0] then his marks must be stored in marks[0] and so on.) the program finally displays the roll number and marks of students with highest marks. Q3: Write programme that for arrays numbers, squares, cubes and sums each consisting of ten elements. The numbers array stores the values of its indexes, the squares array stores the squares of its indexes, the cubes array stores the cubes of its indexes and sum of array stores the sum of corresponding indexes of three arrays. The programme should display the values of sums of array and total of all values in sum array. Q4: Write programme that inputs the names and monthly salaries of ten employees. The programme checks annual salaries of each person. If annual salary is greater than or equal to rupees 2,50000/ then prints name, salaries and a message tax to be paid else it prints name, salaries and a message no tax. Q5: Write a programme that inputs ten integers in an array, it displays the number of occurrences of each number in the array as follows 3 is stored four times in the array. 1 is stored one time in the array Q6: Write a programme that inputs the marks of ten students. The programme displays the number of students in each grade. The criteria is as follows 80 or above 60-79 40-59 Below to 40 A B C F

Q7: Write a programme that use three arrays mango, orange and banana to store the number of fruits purchased by customer. The programme inputs the number of mangoes, oranges and bananas to be purchase by customer and stored them in crosssponding arrays. The finally display the total bill of each customer according to the following price Rs. 20 per mango Rs. 10 per orange Rs. 5 per banana The output should appear as follows Customer number 1 Q8: Write a programme that inputs ten floating points number in an array. It displays the values which are greater than average value of array. Q9: Write a programme that uses of two dimensional arrays to initialize the scores of the students. The students are arranged in five rows with five students in each row. The programme inputs the row number and student number in that row and displays the score of the student. mangoes 5 oranges 10 bananas 12 total bill 260

Chapter- Structures
Q1: Write the programme that declares the structure to store the distance covered by player along with the minutes and seconds taken to the covered the distance. The programme should input the records of two players and then display the record of the winner. Q2: Write a programme that declared the structure the code number, salaries and grade of an employee. The programme refines two structure variables, inputs records of two employees and then display the record of the employee with more salary. Q3: Write a programme that declares a structure to store income, tax rate and tax of a person.

The programme defines an array of structure to store the record of 5%. It input income and tax rate of 5% and then display the tax payable. Q4: Write a programme that declares a structure book to store book id, book name and price. It declares another structure order that contains order id and array of the book of length 5. The programme should define a variable of type order and input the values from users. The programme finally displays the values. _____________________________________________________________

Você também pode gostar