This file contains hidden or 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
| //Factorial of first five odd numbers | |
| package whileLoopBasicPrograms; | |
| public class FactorialOfFirstFiveOddNumbers { | |
| public static void main(String [] args) | |
| { | |
| int count=1; | |
| int total=1; | |
| while(count<10) | |
| { |
This file contains hidden or 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
| //Factorial of first five even numbers | |
| package whileLoopBasicPrograms; | |
| public class FactorialOfFirstFiveEvenNumbers { | |
| public static void main(String [] args) | |
| { | |
| int count=2; | |
| int total=1; | |
| while(count<=10) | |
| { |
This file contains hidden or 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
| //Print First Five Odd Numbers and calculate total value of First Five Odd numbers | |
| package whileLoopBasicPrograms; | |
| public class PrintOddNumber { | |
| public static void main (String [] args) | |
| { | |
| int count =1; | |
| int total=0; | |
| while(count<10) | |
| { |
This file contains hidden or 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
| //Print First Five Even Numbers and Calculate total Value of First Five Even Numbers | |
| package whileLoopBasicPrograms; | |
| public class PrintEvenNumber { | |
| public static void main(String [] args) | |
| { | |
| int count=2; | |
| int total=0; | |
| while(count<=10) | |
| { |
This file contains hidden or 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
| //Balance Calculator | |
| package whileLoopBasicPrograms; | |
| public class BalanceCalculator { | |
| public static void main(String []args) | |
| { | |
| int total=100; | |
| int count=0; | |
| while(count<5) | |
| { |
This file contains hidden or 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
| //First Hundred Number Average Calculator | |
| package whileLoopBasicPrograms; | |
| public class AverageCalculator { | |
| public static void main(String []args) | |
| { | |
| int average; | |
| int total=0; | |
| int number=0; | |
| while(number<100) |
This file contains hidden or 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
| package swappingNumbersProgram; | |
| public class FiveNumberSwap { | |
| public static void main(String [] args) | |
| { | |
| int a=19,b=27,c=35,d=8,e=45; | |
| System.out.println("Before swap a value is "+a); | |
| System.out.println("Before swap b value is "+b); | |
| System.out.println("Before swap c value is "+c); |
This file contains hidden or 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
| package swappingNumbersProgram; | |
| public class SwapFourNumbers { | |
| public static void main(String [] args) | |
| { | |
| int a=23,b=41,c=16,d=34; | |
| System.out.println("Before swap a value is "+a); | |
| System.out.println("Before swap b value is "+b); | |
| System.out.println("Before swap c value is "+c); | |
| System.out.println("Before swap d value is "+d); |
This file contains hidden or 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
| package swappingNumbersProgram; | |
| public class SwappingFourNumbers { | |
| public static void main(String[] args) { | |
| // TODO Auto-generated method stub | |
| int a =2, b=4,c=6,d=8; | |
| System.out.println("Before Swap a value is "+a); | |
| System.out.println("Before Swap b value is "+b); | |
| System.out.println("Before Swap c value is "+c); |
This file contains hidden or 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
| //Swapping Three Numbers Without Fourth Variable | |
| package swappingNumbersProgram; | |
| public class SwappingThreeNumbers { | |
| public static void main(String [] args) | |
| { | |
| int a=5,b=10,c=15; | |
| System.out.println("Before Swap a is "+a); | |
| System.out.println("Before Swap b is "+b); | |
| System.out.println("Before Swap c is "+c); |