Monday, September 16, 2019

Write a java program to compare two strings lexicographicall

Write a java program to compare two strings lexicographically.
Using the compareTo method for comparing the String .
compareTo method is compare the string is based on the unicode value of character .
It return the positive negative and zero value.
if the string are same it return the zero value otherwise it positive or negative value depend on ASCII value of the character .
for example
1st string is s1 = middle
2nd string is s2 = niddle
so it return the value is -1.
bcoz the value of m is 77 and value of n is 78 (ASCII)
so 77 -78 = -1
so the return value is -1 .
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner obj = new Scanner(System.in);
String s1;
String s2;
s1 = obj.nextLine();
s2 =obj.nextLine();
if(s1.compareTo(s2)==0){
System.out.println("string are equal"); }
else{
System.out.println("not "+s1.compareTo(s2)+" is difference ");
} } }

Output:  
  oneo
  oneof
  not -1 is difference.
                

Saturday, September 14, 2019

Amazing and gorgeous calculator theme.

Calculator Vikas Tomar's DEV Profile

Amazing and gorgeous calculator theme.

% UR x2 1/x
CE C BK /
7 8 9 *
4 5 6 -
1 2 3 +
% 0 . =
Calculator

If You wanna to show the coding of this theme click on this

Monday, September 9, 2019

Turtle (python)

clever Vikas Tomar's DEV Profile
                    import turtle 
                    # give the turtle name;
                    clever = turtle.Turtle()
                    clever.color('green')
                    clever.speed(0)
  
                   def draw_square():
                   for side in range(4):
                   clever.forward(100)
                   clever.right(90)
                   for anothersquare in range(4):
                   clever.forward(50)
                   clever.right(90)
                   
                   draw_square()
                   def lotofsquare():
                   for square in range(30):
    
                   clever.color('green')
                   draw_square()
                   clever.penup()
                   clever.forward(20)
                   clever.left(50)
                   clever.pendown()
                   lotofsquare()

IF WE WANT TO SEE OUTPUT CLICK THE BELOW LINK

Arrays in Solidity Programming Language.

Arrays Solidity supports both generic and byte arrays. It supports both fixed size and dynamic arrays. It also supports multidimensional ...