Source Codes

14 Comments

Java program to find whether given no. is Armstrong or not

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 /*Write a program to find whether given no. is Armstrong or not. Example : Input – 153 Output – 1^3 + 5^3 + 3^3 = 153, so it is Armstrong no. */ class Armstrong{ public […]

10 Comments

Java program to generate a invert Triangle 4444 333 22 1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 /* Write a program to Display Invert Triangle. Example: Input – 5 Output : 5 5 5 5 5 4 4 4 4 3 3 3 2 2 1 */ class InvertTriangle{ public […]

33 Comments

Java program to Find whether number is Prime or Not

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 class PrimeNo{ public static void main(String args[]){ int num = Integer.parseInt(args[0]); int flag=0; for(int i=2;i<num;i++){ if(num%i==0) { System.out.println(num+" is not a Prime Number"); flag = 1; break; } } if(flag==0) System.out.println(num+" is a Prime Number"); } }

24 Comments

Java program to generate a Triangle 1 22 333 444

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 /*Write a program to generate a Triangle. eg: 1 2 2 3 3 3 4 4 4 4 and so on as per user given number */ class Triangle{ public static void main(String args[]){ int num = Integer.parseInt(args[0]); […]

1 Comment

Java program to convert given no. of days into months and days

1 2 3 4 5 6 7 8 9 10 11 12 13 /* Write a program to convert given no. of days into months and days. (Assume that each month is of 30 days) Example : Input – 69 Output – 69 days = 2 Month and 9 days */ class DayMonthDemo{ public static […]

No Comments

Java program to Swap the values

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 class Swap{ public static void main(String args[]){ int num1 = Integer.parseInt(args[0]); int num2 = Integer.parseInt(args[1]); System.out.println("\n***Before Swapping***"); System.out.println("Number 1 : "+num1); System.out.println("Number 2 : "+num2); //Swap logic num1 = num1 + num2; num2 = num1 – num2; num1 = […]

14 Comments

Java program to Display Multiplication Table

1 2 3 4 5 6 7 8 9 10 11 12 class MultiplicationTable{ public static void main(String args[]){ int num = Integer.parseInt(args[0]); System.out.println("*****MULTIPLICATION TABLE*****"); for(int i=1;i<=num;i++){ for(int j=1;j<=num;j++){ System.out.print(" "+i*j+" "); } System.out.print("\n"); } } }

No Comments

Java program to Concatenate natural numbers up to given range

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 /* Write a program to Concatenate natural numbers up to given range using for Loop Example: Input – 5 Output – 1 2 3 4 5 */ class Join{ public static void main(String args[]){     int num = […]

1 Comment

Java program to find sum of all integers between 100 & 200 that are divisible by 7

1 2 3 4 5 6 7 8 9 10 11 12 /* Write a program to find sum of all integers greater than 100 and less than 200 that are divisible by 7 */ class SumOfDigit{ public static void main(String args[]){ int result=0; for(int i=100;i<=200;i++){ if(i%7==0) result+=i; } System.out.println("Output of Program is : "+result); […]

78 Comments

Java program to find Fibonacci series of a given number

Java program to find Fibonacci series of a given number 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 /*Write a program to find Fibonacci series of a given no. Example : Input – 8 Output – 1 1 2 3 5 8 13 21 […]


Electrofriends
Submit Your

Research Papers

Click Here to Submit

Electrofriends
Submit Your

Projects

Click Here to Submit

Free email signup

Get latest projects, articles in your mail box, subscribe to electrifriends

Email:
Recent Questions
    Technical Papers