-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9a3f89e
commit 21077b3
Showing
99 changed files
with
4,741 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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._______(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
Oops, something went wrong.