how to form bitonic sequence in java code example
Example 1: system.in example in java
package com.mkyong.io;
import java.util.Scanner;
public class JavaScanner {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String input = "";
while (!"q".equalsIgnoreCase(input)) {
System.out.print("Enter something (q to quite): ");
input = scanner.nextLine();
System.out.println("input : " + input);
}
System.out.println("bye bye!");
}
}
Example 2: math.pow in C# using loop
static float CalculatePower(float x, int y)
{
float temp;
if (y == 0)
return 1;
temp = CalculatePower(x, y / 2);
if (y % 2 == 0)
return temp * temp;
else
{
if (y > 0)
return x * temp * temp;
else
return (temp * temp) / x;
}
}
Example 3: math.pow in C# using loop
static void Main(string[] args)
{
float x = float.Parse(Console.ReadLine());
int y = int.Parse(Console.ReadLine());
float result = CalculatePower(x, y);
Console.WriteLine("{0} to the power of{1} is {2} ", x, y, result);
}