WRITE AN APPLICATION FOR ADDITION OF
NUMBERS
import [Link];
public class Add{
public static void main(String[] args)
Scanner Sc= new Add([Link]);
[Link]("enter first number");
int a=[Link]();
[Link]("enter the second number");
int b=[Link]();
int c=a+b;
int m=a*b;
int d=a/b;
int s=a-b;
[Link]("sum="+c + "\nsub="+s + "\nmul="+m + "\
ndiv="+d);
********************output**************************
**
enter first number 45
enter second number 2
sum=47
sub=43
mul=90
div=22.5*/
WRITE AN APPLICATION FOR CHECK THE NUMBER IS
POSITIVE OR NEGATIVE
import [Link];
public class Evenodd{
public static void main(String[] args){
Scanner Sc= new Scanner([Link]);
[Link]("enter the number ");
Double n= [Link]();
if(n>0)
[Link]("number is positive");
else if(n<0)
[Link]("number is negative");
else
[Link]("number is zero");
/*********************OUTPUT******************
enter the number 65
number is positive*/
============================================
==========================
JAVA DEMO0 NANR
public class Demo0{
static void add(){
int a,b,c;
a=10;
b=70;
c=a+b;
[Link]("c="+c);
public static void main(String[]args){
add();
/******************OUTPUT**********************
C=80*/
============================================
==========================
WRITE AN APPLICATION OF DEMO1 WANR
public class Demo1{
static void add (int a,int b){
int c=a+b;
[Link]("c="+c);
public static void main(String[]args){
add(5,6);
/
******************************OUTPUT***************
******
c=11*/
============================================
==========================
WRITE AN APPLICATION OF DEMO2 WAWR (65)
public class Demo2{
static int add( int a,int b){
int c=a+b;
return c ;
public static void main (String[] args) {
int d=add(4,3);
[Link]("d="+d);
/**********************OUTPUT*********************
d=7*
WRITE AN APPLICATION OF DEMO3 NAWR
public class Demo3{
static int add(){
int a=19;
int b=89;
int c=a+b;
return c;
public static void main(String[]args)
int d=add();
[Link]("d="+d);
/
****************************OUTPUT*****************
******
d=108*/
=================================
===================