Maths and Java
Question: A sum of 3000 INR is to be given in the form of 63 prizes. If the prize money is either 100 INR or 25 INR. Find the number of prizes of each type.
Maths: Let the count of prizes in sum of rupees 100 each be X
Then the value of prize be 100X
Let the count of prizes in sum of rupees 25 each be Y
Then the value of prize be 25Y
Total number of prizes is X+Y=63 ----------->1
X=63-Y
Now the Total prize value is 3000.
Then 100X+25Y=3000 --------->2
100(63-Y)+25Y=3000
6300-100Y+25Y=3000
3300=75Y
Y=44
Then X=63-44=19
Now apply the value of X and Y in Equation 1 and 2.
So there are 19 prizes worth 100 rupees each and 44 prizes 25 rupees each.
Now the same problem to be solved in java program
Maths: Let the count of prizes in sum of rupees 100 each be X
Then the value of prize be 100X
Let the count of prizes in sum of rupees 25 each be Y
Then the value of prize be 25Y
Total number of prizes is X+Y=63 ----------->1
X=63-Y
Now the Total prize value is 3000.
Then 100X+25Y=3000 --------->2
100(63-Y)+25Y=3000
6300-100Y+25Y=3000
3300=75Y
Y=44
Then X=63-44=19
Now apply the value of X and Y in Equation 1 and 2.
So there are 19 prizes worth 100 rupees each and 44 prizes 25 rupees each.
Now the same problem to be solved in java program
Comments
Post a Comment