Removed the Misc directory and moved the files to other

This commit is contained in:
Varun Upadhyay
2017-11-05 10:17:19 -08:00
parent c8038cd6f0
commit eed6f33976
4 changed files with 6 additions and 51 deletions

View File

@ -1,17 +0,0 @@
import java.util.Scanner;
class FloydTriangle {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the number of rows which you want in your Floyd Triangle: ");
int r = sc.nextInt(), n = 0;
for(int i=0; i < r; i++) {
for(int j=0; j <= i; j++) {
System.out.print(++n + " ");
}
System.out.println();
}
}
}

View File

@ -1,33 +0,0 @@
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
//take input
Scanner scn = new Scanner(System.in);
int N = scn.nextInt(); //N is the input number
int P = scn.nextInt(); //P is precision value for eg - P is 3 in 2.564 and 5 in 3.80870.
System.out.println(squareRoot(N, P));
}
public static double squareRoot(int N, int P) {
double rv = 0; //rv means return value
double root = Math.pow(N, 0.5);
//calculate precision to power of 10 and then multiply it with root value.
int precision = (int) Math.pow(10, P);
root = root * precision;
/*typecast it into integer then divide by precision and again typecast into double
so as to have decimal points upto P precision */
rv = (int)root;
return (double)rv/precision;
}
}

View File

@ -1,6 +1,7 @@
import java.util.Scanner;
public class FloydTriangle {
class FloydTriangle {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the number of rows which you want in your Floyd Triangle: ");

View File

@ -1,4 +1,8 @@
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {