DUET PG Score Card 2021
NHAI Recruitment 2021
Bihar Board 12th Dummy Admit Card 2022
RBI Assistant Notification 2021
Jee Advanced 2021 Result
NIACL Assistant Recruitment 2021
SBI PO Online Form 2021

Create a class PrintDiff with a public method computeDiff that takes two parameters firstNo and secondNo are of type int.

Java; Create a class PrintDiff with a public method computeDiff that takes two parameters firstNo and secondNo are of type int.

Calculate the difference between firstNo and secondNo. If the value of the difference is in between -25 and 25, the program should double the value and print the output, otherwise it should print the difference as it is.

For example:

Cmd Args : 15 7
16
package q10921;
public class PrintDiff {
    public void computeDiff(int firstNo, int secondNo) {
        int d = firstNo - secondNo;
        if (d > -25 && d < 25) {
            System.out.println(d + d);
        } else {
            System.out.println(d);
        }
    }
}
Image Speedjobalert
Image 1 Speedjobalert
Image 2 Speedjobalert

Candidates having any kind of query so he/she can ask in our comment section. Our Panel will b reverting back as soon as possible. Thank You. For more details visit our website (https://speedjobalert.com/)

Leave a Comment