Posts

Blockchain-program(easy)

A simple and very old method of sending secret messages is the substitution cipher. You might have used this cipher with your friends when you were a kid. Basically, each letter of the alphabet gets replaced by another letter of the alphabet. For example, every 'a' get replaced with an 'X', and every 'b' gets replaced with a 'Z', etc. Write a program thats ask a user to enter a secret message. Encrypt this message using the substitution cipher and display the encrypted message. Then decryped the encrypted message back to the original message. You may use the 2 strings below for  your subsitition. For example, to encrypt you can replace the character at position n in alphabet with the character at position n in key. To decrypt you can replace the character at position n in key with the character at position n in alphabet. Have fun! And make the cipher stronger if you wish! Currently the cipher only substitutes letters - you could easily...

Kotlin basics_habijabi -variable to hashmap

Kotlin basics_habijabi fun main(args : Array ) { // println("Enter a  Number") //    var x:Int=readLine()!!.toInt() // println("Enter a  Number") //    var y:Int=readLine()!!.toInt() // println(x+y) // // println("Enter number") // var x:Int=readLine()!!.toInt() // // when(x) // { // 1->println("A") // 2->println("B") // in 3..5 -> println("C") // // else -> println("D") // // } //var x:Int // while(x<=5){ // println(x) // x++ // } // for(x in 1..10){ // print(x) // print(" ") // } // // println() // // for(y in 10 downTo 1){ // print(y) // print(" ") // } // println() // for( z in 1..10 step 3){ // print(z) // print(" ") // } var bloodGroup=arrayOf("sifat","abc","def") for( x in bloodGroup) println(x) println(bloodGroup[0]) var bo...

Bubble Sort Algorithm in java

Image
Bubble Sort Algorithm package one; public class One { public static void main(String[] args) { // TODO Auto-generated method stub int[] intArray= {20,35,-15,7,55,1,-27}; for(int lastUnsortedIndex=intArray.length-1;lastUnsortedIndex >0;lastUnsortedIndex--) { for(int i=0;i<lastUnsortedIndex;i++) { if(intArray[i]>intArray[i+1]) { swap(intArray,i,i+1); } } } for(int i=0;i<intArray.length;i++) { System.out.print(intArray[i]+"  "); } } public static void swap(int [] array,int i,int j) { if(i==j) { return; } int temp=array[i]; array[i]=array[j]; array[j]=temp; } }

StringBuffer In Java

StringBuffer In Java: package one; public class StringBuffer { public static void main(String[] args) { java.lang.StringBuffer sb=new java.lang.StringBuffer("Hello ");  System.out.println(sb.capacity()); sb.append("Java"); System.out.println(sb); sb.insert(2," haha "); System.out.println(sb); sb.replace(1, 4, "huhuhuhu"); System.out.println(sb); sb.ensureCapacity(10); System.out.println(sb.capacity()); sb.delete(1, 18); System.out.println(sb); System.out.println(sb.capacity()); sb.reverse(); System.out.println(sb); }  } 

Convert LinkList To ArrayList in Java

Convert LinkList To ArrayList in Java: package one; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; public class LinkToArray { public static void main(String[] args) {     LinkedList<String> linkedlist = new LinkedList<String>();     linkedlist.add("Sifat");     linkedlist.add("mohaiminur"); linkedlist.add("huda"); linkedlist.add("sakib"); linkedlist.add("robi"); List<String> list = new ArrayList<String>(linkedlist); for (String str : list){    System.out.println(str); } } }

HashMap In Java

package one; import java.util.Map; public class HashMap { public static void main(String[] args) { Map<Integer,String> map=new java.util.HashMap<Integer,String>(); map.put(1,"b1"); map.put(2,"b2"); map.put(3,"b3"); for(Integer i: map.keySet()) { System.out.println(map.get(i)); } } }

Sum of digits, Reverse, Palindrome & Armstrong Number Checker

Sum of digits, Reverse, Palindrome & Armstrong Number Checker: package checker; import java.util.Scanner; public class Check { public static void main(String[] args) { int sum=0,s,temp,num,c; System.out.println("Enter any number: "); Scanner input=new Scanner(System.in); num=input.nextInt(); temp=num; System.out.println("Enter 0 for Sum of digits."); System.out.println("Enter 1 for Reverse number."); System.out.println("Enter 2 for Palindrome number."); System.out.println("Enter 3 for Armstrong number."); Scanner input0=new Scanner(System.in); System.out.println(); c=input0.nextInt(); switch(c) { case 0: {   while(temp!=0) { s=temp%10; sum=sum+s; temp=temp/10; } System.out.println("Sum of digits: "+sum); break; } case 1: { while(temp!=0) { s=temp%10; sum=sum*10+s...