package javaProgramming;
import [Link];
public class calci
{
public static void main(String args[])
{
Scanner sc= new Scanner([Link]);
[Link]("a = ");
int a = [Link]();
[Link]("b = ");
int b= [Link]();
[Link]("c = ");
int c=[Link]();
calci ob = new calci();
[Link]("1. Addition of a and b = " +[Link](a, b));
substraction(a, b);
greatervalue(a, b, c);
[Link]("4. Factorial of " +c+ " = " +[Link](c));
//[Link](c);
[Link](a, b);
[Link](c);
}
int result;
static int minus;
public int addition(int x, int y)// instance return type method
{
result = x+y;
return result;
}
public static void substraction(int x, int y) // no return type static method
{
minus= x-y;
[Link]("2. Substraction of a and b = " +minus);
}
public static void greatervalue(int x, int y, int z)//no return type no static
{
if(x>y & x>z)
{
[Link]("3." +x+ " is a greater number among a, b and c");
}
if(y>x & y>z)
{
[Link]("3." +y+ " is a greater number among a, b and c");
}
else
{
[Link]("3." +z+ " is agreater number among a b and c. ");
}
}
public int factorial(int x)
{
int fact=1;
for(int i=x;i>=1;i--)
{
fact=fact*i;
//[Link]("factorial of " +x+ "is:" +fact );
}
return fact;
}
public void swapping(int x, int y)//no return type no static
{
int z;
z=x;
x=y;
y=z;
[Link]("5. After swapping: b = " +y+ " & a = " +x);
}
public void checkprime(int x) // method for check a number is prime or not.
{
int n=x/2, flag=0;
for(int i=2;i<=n;i++)
{
if(x%i==0)
{
[Link]("6. " +x+" is not a prime number");
flag=1;
break;
}}
if(flag==0)
{
[Link]("6. " +x+ " is a prime number");
}
}