Monday, December 12, 2016

Lets Start Programming A Simple Java Problem

      Here is the Code For a Simple Java Programme.😊😊😊




You can give the correct Answer for the given problem and Share knowledge too.. Submit your Answer in the comment Line. 



---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------

import java.util.*;
class Example{
public static void main(String args[]){
Scanner input=new Scanner(System.in);
System.out.print("Input a number : ");
int num=input.nextInt();
if(num==1 || num==2){
if(num==1){
System.out.println("A");
}
System.out.println("B");
}else{
System.out.println("Wrong number");
}
}

What  Can be the Answer when Input Number is Equals to 1 , 2 and AnyOther Number.
Output : 

------------------------------------------------------------------------------------------------------------------------------

0 comments:

Post a Comment