Monday 23 March 2020

DISPLAYING MESSAGE USING JAVA LANGUAGE

Q-6- Let we have two values 113, 2.71828. Then, declare two different variables to hold the given values. Write the java program to display the values of these two variables on the screen, one per line.
INPUT :
public class NCM {

public static void main(String[] args) {
// TODO Auto-generated method stub
int a=113;
double b=2.71828;
System.out.println("This is room # "+ a);
System.out.println("e is close to "+ b);
}

}

OUTPUT :
This is room # 113

e is close to 2.71828

No comments:

Post a Comment