code converter java to C
import java.util.HashSet;
import java.util.Scanner;
class SerenaFlowers{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
sc.nextLine();
int arr[] = new int[n];
String a[] = sc.nextLine().split(" ");
HashSet hs = new HashSet<>();
for(int i =0 ; i < a.length ; i++)
{
arr[i] = Integer.parseInt(a[i]);
if(i
code converter java to C
import java.util.LinkedList;
import java.util.List;
class SuffixTrieNode {
final static int MAX_CHAR = 256;
SuffixTrieNode[] children = new SuffixTrieNode[MAX_CHAR];
List indexes;
code converter java to c
import java.math.BigInteger;
import java.util.Scanner;
public class Chooser
{
BigInteger num;
public static BigInteger findNumber(Chooser c)
{
Scanner s = new Scanner(System.in);
while(true)
{
System.out.println("choose a number (greater than zero): ");
c.num = s.nextBigInteger();
if(c.num.compareTo(BigInteger.valueOf(0))>0)
break;
}
return c.num;
}
public String guess(BigInteger number)
{
Scanner s = new Scanner(System.in);
while(true){
System.out.println("enter a guess: ");
this.num = s.nextBigInteger();
if(this.num.compareTo(number) == 0)
return "your answer is correct";
else if(this.num.compareTo(number) == 1)
return "the correct answer is lower";
else// (this.num.compareTo(number)== -1)
return "the correct answer is higher";
}
}
public static void main(String[] args)
{
Chooser choose = new Chooser();
BigInteger num = Chooser.findNumber(choose);
String guess = choose.guess(num);
while(true){
if(!guess.equalsIgnoreCase("your answer is correct"))
{
System.out.println(guess);
guess = choose.guess(num);
}
else
{
System.out.println(guess);
return;
}
}
}
}
code converter java to C
package demo;
import com.mtsystems.coot.IntContainer;
import com.mtsystems.coot.NativeHelper;
import com.mtsystems.coot.String8;
public class DemoTranslation {
static {
// The online demo uses the example library "libc.so.6".
// Have a look at the translated programs for real values.
NativeHelper h = NativeHelper.get("libc.so.6");
h.bindDirect(DemoTranslation.class);
}
public static native int readinput(String8 arg1, String8 arg2, IntContainer arg3);
public static native int printoutput(String8 arg1, String8 arg2, IntContainer arg3);
public static void main(String[] args) {
String8[] fname = new String8[3], lname = new String8[3];
IntContainer[] marks = new IntContainer[3];
System.out.print("Hello World");
}
}
code converter java to C
import java.util.LinkedList;
import java.util.List;
class SuffixTrieNode {
final static int MAX_CHAR = 256;
SuffixTrieNode[] children = new SuffixTrieNode[MAX_CHAR];
List indexes;
code converter java to C
package train;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
System.out.println("Please enter your name");
Scanner scanner = new Scanner(System.in);
String name = scanner.nextLine();
System.out.println("Welcome" + name);
}
}
code converter java to C
import java.util.Arrays;
class problem9 {
public static void main(String[] args) {
System.out.println("The main method is starting here ");
int array1[] = { 1, 3, 5, 4, 8, 6, 7, 100, 99, 88, 97 };
System.out.println("The original array is : " + Arrays.toString(array1));
// sorting array elemets in decending order
for (int i = 0; i < array1.length - 1; i++) {
if (array1[i] < array1[i + 1]) {
int temp = array1[i];
array1[i] = array1[i + 1];
array1[i + 1] = temp;
// important line of this code
i = -1;
}
}
System.out.println("The sorted array is : " + Arrays.toString(array1));
int k = 3;
int res = 0;
// Adding k highest elements in sorted array
for (int i = 0; i < k; i++) {
res = res + array1[i];
}
System.out.println("The sum of top " + k + " scorers is " + res);
System.out.println("The main method is ending here ");
}
}
code converter java to c
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
int n,i,j;
int[][] a=new int[50][50];
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
for(i=0;i10 && a[i][j]!=20)
{
System.out.println("No");
return;
}
}
}
System.out.println("Yes");
}
}
|