CP Assignment2
CP Assignment2
Assignment - 2
Total Marks: 10
Answer the following questions on blank loose papers (without lines) and submit to your
respective teaching faculty. It should be handwritten only.
Input:
Output:
2. A saddle point in a matrix is an element that is the smallest element in its row and the
largest element in its column. Write a C program to find the saddle point in a given
N×M matrix. If no saddle point exists, the program should output No saddle point
found.
Input:
● Two integers N and M representing the number of rows and columns in the
matrix, respectively.
● An N×M matrix of integers.
Output:
● The row and column number of the saddle point if it exists, or No saddle point
found if no such point exists.
3. Write a C program that repeatedly prompts the user to enter a number until a consecutive
prime sum is reached. A consecutive prime sum is a sum of consecutive prime numbers
starting from the smallest prime number (2) that equals or exceeds the entered number. If
the sum exceeds the number, the program should start again by prompting for a new
input.
Input:
● A single positive integer N entered by the user (greater than or equal to 2).
Output:
● Display the sum of consecutive prime numbers starting from 2 that equals the
entered number.
● If the sum exceeds the entered number, prompt the user to enter a new number
until a valid sum is achieved.
Example Input/Output:
Example 1:
Enter a number: 10
Example 2:
Enter a number: 12
Enter a number: 15
Enter a number: 17
* *
* * * *
* * * * * *
* * * * * * * *
* * * * * * * * *
5. Design a program to manage and analyze student grades for multiple subjects. The
program will allow the user to input student data, calculate average grades, and determine
the highest and lowest grades in each subject.
Input:
Output:
Requirements:
● Use 2D arrays to store the grades for each student and subject.
● Utilize loops for input, processing, and output.
● Ensure proper handling of student and subject limits.