info@meritcampus.com    +91-85006-22255
...
`

Write a program to print the possible combinations of marks of a student given the total marks.
Note: Assume he did not fail in any subject and did not get distinction in any subject. Assume that number of subjects is 3, maximum marks per subject is 10, fail marks is less than or equal to 3 and distinction is greater than or equal to 8.

Input (Integer) Output (Printed Output)
18 `4 7 75 6 75 7 66 5 76 6 66 7 57 4 77 5 67 6 57 7 4`
20 `6 7 77 6 77 7 6`
12 `4 4 4`
15 `4 4 74 5 64 6 54 7 45 4 65 5 55 6 46 4 56 5 47 4 4`
21 `7 7 7`

``` class PrintPossibleMarks {     public static void main(String s[])    {        System.out.println("Possible marks of the student : ");        printPossibleMarks(18);    }     public static void printPossibleMarks(int totalMarks) { ```
```     } } ```
Topic:

### User comments below.All of them might not be correct.

As per the program, we need to print the marks for 3 exams which are between 4 and 7...
For this we need to take 3 nested loops iterates through 4 to 7... outer for loop for first subject and first inner for loop for second subject and inner most for loop is for third subject... we need to print the marks of 3 subjects only if sum of all the 3 subjects are equal to the total...

Posted by Gopinath Manchikanti    2015-02-20 06:12:35

*here we need to use three nested loop to calculate the sum
three loops for the each subject here we need to travel from 4 to 7 bcz students did not get failed or did not get disctinction
* in the inner most loop cal the sum of the s1+s2+s3 if the sum is =totalMarks than print the values of the s1 s2 s3 with the spaces

Posted by Uday Kumar    2015-02-23 03:29:16

This dose is now closed and the winners are Gopinath Manchikanti,  for 'First Correct Comment', Uday Kumar,  for 'Second Correct Comment'. The 'lucky liker' is Gopinath Manchikanti. Please login into Merit Campus using facebook, to claim your recharge. Go to http://java.meritcampus.com/earnings to raise the recharge.

Posted by Merit Campus    2015-02-24 04:54:54