AF
HomeTagSubmit NotesAsk AnythingLoginSubscribe Us
AF
1. Feel Free to ask and submit anything on Anyforum.in and get satisfactory answer
2. Registration is not compulsory, you can directly login via google or facebook
3. Our Experts are looking for yours ?.



corejava-programming: Same or Not

Take two positive integer values from the user, print their sum, unless the two values are the same, then print double of their product.


corejava x 353
programming x 168
Posted On : 2016-12-22 11:28:00.0
profile nav raj - anyforum.in nav raj
1200
up-rate
3
down-rate

Answers


import java.util.Scanner;

public class SumMul {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int a=input.nextInt();
int b=input.nextInt();
System.out.println(a==b?2*a*b:a+b);
}
}

Posted On : 2016-12-22 23:26:32
Satisfied : 1 Yes  0 No
profile Rishi Kumar - anyforum.in Rishi Kumar
523188222694
Reply This Thread
up-rate
5
down-rate



Post Answer
Please Login First to Post Answer: Login login with facebook - anyforum.in