Monday, December 4, 2017

Friday, November 24, 2017

Wednesday, November 22, 2017

Friday, April 14, 2017

Write a program to Get numbers from String

   public class StringReplace { public static void main(String[] args) { // TODO Auto-generated method stub String str = "ha656rishwajhd8676676r"; System.out.println("enput string is= "+str); String strstr; strstr=str.replaceAll("[a-z]", ""); System.out.println(strstr); ...

Print Even Numbers From Given Array

  Print Even Numbers From Given Array import java.util.Scanner; public class EvenFinder { public static void main(String[] args) { int arr[]={1,2,3,4,5,6,7,8,9,10}; for (int i = 0; i <= arr.length; i++) { if(i%2==0){ System.out.print(i+" "); } } } } Output: 2...

Wednesday, April 12, 2017

java program to print square of stars

 package day2; import java.util.Scanner; public class PrintSquareBox { public static void main(String[] args) { int num = 5; for (int i = 0; i < num; i++) { System.out.print("3 "); } System.out.println(); for (int j = 0;...

To print sum of digits:

  To print sum of digits: public class SumOfDigits { public static void main(String[] args) { int num = 67; System.out.println(getSumOfDigits(num)); } public static int getSumOfDigits(int num) { int sum = 0; if(num<0) { return -3; }else if(num>99){ return -2; ...

Monday, April 3, 2017

To check the given number is Amstrong or Not

package date24; public class Amstrong { public static void main(String[] args) { int first = 153; int num = first; int digits = 0; while (num > 0) { num = num / 10; digits++; } int s = 0; int n = first; while (n > 0) { int rem = n % 10; int sum = (int) Math.pow(rem,...

Matrix Addition program using java

Matrix Addition program using java package day1; import java.util.Scanner; public class MatrixAddition { public static void main(String[] args) { int a[][] = new int[2][2]; int b[][] = new int[2][2]; int sum[][] = new int[2][2]; Scanner sc = new Scanner(System.in); System.out.println("enter...

write a calculator program using Html ans JavaScript

calculator program using HTML and JavaScript: <HTML> <HEAD> <STYLE> #ab{height:50%; width:50%; } </STYLE> </HEAD> <BODY> <center> <h1>CALCULATOR<h1> <FORM NAME="Calc" id="ab"> <center> <TABLE...

Verify a number is Even/Odd

.crayon-syntax .crayon-plain { width: 100%; height: 100%; position: absolute; opacity: 0; padding: 0 5px; margin: 0; border: 0; box-sizing: border-box; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-shadow: none; border-radius: 0; -webkit-box-shadow:...