PVM Question
PVM Question
import java.io.*;
class KaprekarNum
{
public static void main(String args[]) throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter a Number : ");
int n = Integer.parseInt(br.readLine()); //Inputting the number
if(sq<=9)
s = "0"+s; //Adding a zero in the beginning if the square is of single digit
int l = s.length(); //finding the length (i.e. no. of digits in the square).
int mid = l/2; //finding the middle point
//if sum of left and right numbers is equal to the original number then it is a Kaprekar number
if(x+y == n)
System.out.println(n+" is a Kaprekar Number");
else
System.out.println(n+" is Not a Kaprekar Number");
}
}
Write a program in Java to store the number in 4x4 matrix in a double dimensional
import java.util.Scanner;
matrix[i][j] = scanner.nextDouble();
}
double highest = matrix[0][0];
highest = matrix[i][j];
lowest = matrix[i][j];
//Initialize matrix a
int a[][] = {
{4, 1, 3},
{3, 5, 7},
{8, 2, 6}
};
OUTPUT : BWAOLRLD
import java.util.Scanner;
if(s2.length() == len)
{
for (int i = 0; i < len; i++)
{
char ch1 = s1.charAt(i);
char ch2 = s2.charAt(i);
str = str + ch1 + ch2;
}
System.out.println(str);
}
else
{
System.out.println("Strings should be of same length");
}
}
}