Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
vaibhavpatilX authored Jun 22, 2024
1 parent 9a3f89e commit 21077b3
Show file tree
Hide file tree
Showing 99 changed files with 4,741 additions and 0 deletions.
Binary file added Program248.class
Binary file not shown.
32 changes: 32 additions & 0 deletions Program248.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import java.util.*;

class Program248
{
public static void main(String arg[])
{
Scanner sobj = new Scanner(System.in);

int iNo1 = 0, iNo2 = 0, iAns = 0;

System.out.println("Enter first number : ");
iNo1 = sobj.nextInt();

System.out.println("Enter second number : ");
iNo2 = sobj.nextInt();

Arithematic aobj = new Arithematic();
iAns = aobj.Addition(iNo1,iNo2);

System.out.println("Addition is : "+iAns);
}
}

class Arithematic
{
public int Addition(int i,int j)
{
int Sum = 0;
Sum = i+j;
return Sum;
}
}
Binary file added Program249.class
Binary file not shown.
40 changes: 40 additions & 0 deletions Program249.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import java.util.*;

class Program249
{
public static void main(String arg[])
{
Scanner sobj = new Scanner(System.in);

int iNo1 = 0, iNo2 = 0, iAns = 0;

System.out.println("Enter first number : ");
iNo1 = sobj.nextInt();

System.out.println("Enter second number : ");
iNo2 = sobj.nextInt();

Arithematic aobj = new Arithematic(iNo1,iNo2);
iAns = aobj.Addition();

System.out.println("Addition is : "+iAns);
}
}

class Arithematic
{
public int iValue1;
public int iValue2;

public Arithematic(int i,int j)
{
iValue1 = i;
iValue2 = j;
}
public int Addition()
{
int Sum = 0;
Sum = iValue1 + iValue2;
return Sum;
}
}
Binary file added Program250.class
Binary file not shown.
22 changes: 22 additions & 0 deletions Program250.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import java.util.*;

class Numbers
{
// Method
}

class Program250
{
public static void main(String A[])
{
Scanner sobj = new Scanner(System.in);

System.out.println("Please enter number : ");
int iNo = sobj.nextInt();

Numbers nobj = new Numbers();

nobj._______();

}
}
37 changes: 37 additions & 0 deletions Program251.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import java.util.*;

class Program250
{
public static void main(String A[])
{
Scanner sobj = new Scanner(System.in);

System.out.println("Please enter number : ");
int iNo = sobj.nextInt();

Numbers nobj = new Numbers();

nobj.EvenFactorsDisplay(iNo);

}
}

class Numbers
{
public void EvenFactorsDisplay(int iNo)
{
int iCnt = 0;

for(iCnt = 1;iCnt <= (iNo/2); iCnt++)
{
if((iNo % iCnt) == 0)
{
if((iCnt % 2 ) == 0)
{
System.out.println("Even factors is : "+iCnt);
}
}
}
}
}

Binary file added Program253.class
Binary file not shown.
35 changes: 35 additions & 0 deletions Program253.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import java.util.*;

class Program253
{
public static void main(String A[])
{
Scanner sobj = new Scanner(System.in);

System.out.println("Please enter number : ");
int iNo = sobj.nextInt();

Numbers nobj = new Numbers();

nobj.EvenFactorsDisplay(iNo);
}
}

class Numbers
{
public void EvenFactorsDisplay(int iNo)
{
int iCnt = 0;

for(iCnt = 2; iCnt <= (iNo/2); iCnt+=2) // iCnt = iCnt + 2
{
if((iNo % iCnt) == 0)
{
System.out.println("Even factor is : "+iCnt);
}
}

}
}


Binary file added Program254.class
Binary file not shown.
40 changes: 40 additions & 0 deletions Program254.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import java.util.*;

class Program254
{
public static void main(String A[])
{
Scanner sobj = new Scanner(System.in);

System.out.println("Please enter first number : ");
int iNo1 = sobj.nextInt();

System.out.println("Please enter second number : ");
int iNo2 = sobj.nextInt();

Numbers nobj = new Numbers();

nobj.CommonFactorsDisplay(iNo1,iNo2);
}
}

class Numbers
{
public void CommonFactorsDisplay(int iNo1,int iNo2)
{
int iCnt = 0;

System.out.println("Common Factors are : ");

for(iCnt = 1;(iCnt <= iNo1/2) && (iCnt <= iNo2/2); iCnt++)
{
if((iNo1 % iCnt == 0) && (iNo2 % iCnt == 0))
{
System.out.println(iCnt);
}
}

}
}


Binary file added Program255.class
Binary file not shown.
39 changes: 39 additions & 0 deletions Program255.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import java.util.*;

class Program255
{
public static void main(String A[])
{
Scanner sobj = new Scanner(System.in);

System.out.println("Please enter number : ");
int iNo = sobj.nextInt();

Numbers nobj = new Numbers();

int iRet = nobj.FactorsMultiplication(iNo);

System.out.println("Multifliation of factors of "+ iNo +" is : "+iRet);
}
}

class Numbers
{
public int FactorsMultiplication(int iNo)
{
int iCnt = 0;
int iMult = 1;


for(iCnt = 1; iCnt <= (iNo/2); iCnt++)
{
if((iNo % iCnt) == 0)
{
iMult = iMult * iCnt;
}
}
return iMult;
}
}


78 changes: 78 additions & 0 deletions Program256.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import java.util.*;

class Digits
{
private int CountDigits(int iNo)
{
int iCnt = 0;
while(iNo != 0)
{
iCnt++;
iNo = iNo / 10;
}
return iCnt;
}

private int Power(int Base, int index) // Base = 4 index = 5
{
int iAns = 1;

for(int iCnt = 1; iCnt <= index; iCnt++)
{
iAns = iAns * Base;
}
return iAns;
}

public boolean CheckArmstrong(int iNo)
{
int iTemp = iNo;
int iSum = 0;
int iDigit = 0;
int iRet = 0;

int iCount = CountDigits(iNo);

while(iNo != 0)
{
iDigit = iNo % 10;

iRet = Power(iDigit, iCount);
iSum = iSum + iRet;

iNo = iNo / 10;
}

if(iSum == iTemp)
{
return true;
}
else
{
return false;
}
}
}

class Program256
{
public static void main(String A[])
{
Scanner sobj = new Scanner(System.in);

System.out.println("Please enter number : ");
int iNo = sobj.nextInt();

Digits dobj = new Digits();

boolean bRet = dobj.CheckArmstrong(iNo);
if(bRet == true)
{
System.out.println(iNo+ " is a Armstrong number.");
}
else
{
System.out.println(iNo+ " is not a Armstrong number.");
}
}
}
Binary file added Program257.class
Binary file not shown.
Loading

0 comments on commit 21077b3

Please sign in to comment.