1. WAP to sum of two numbers.
import [Link];
class Sum {
public static void main(String[] args)
{
Scanner user = new Scanner([Link]);
int a;
float b,sum;
[Link]("Enter integer number:");
a=[Link]();
[Link]("Enter float number:");
b=[Link]();
sum = b + a;
[Link]("Sum is :" + sum);
}
}
OUTPUT:
2. WAP to swap two numbers.
import [Link];
class Swapping{
public static void main(String[] args)
{
Scanner user = new Scanner([Link]);
int a,b,c;
[Link]("Enter the value of a:");
a=[Link]();
[Link]("Enter the value of b:");
b=[Link]();
[Link]("value at a is "+a);
[Link]("value at b is" +b);
c=a;
a=b;
b=c;
[Link]("value at a after swap is "+a);
[Link]("value at b after swap is" +b);
}
}
OUTPUT:
3. WAP to print to check whether the given number is prime or not.