Computer Science, asked by srushti200496, 11 months ago

write a program in java to input a number and print the largest odd number and show the output​

Answers

Answered by blackhat89
0

Explanation:

import java.util.Scanner;

class A {

public static void main(String args[])

{ int x[50],i,max =0;

int y;

System.out.println("Enter the size: ");

y = in.nextInt();

System.out.println("Input size is: "+y);

for (i=0;i<y;i++)

{

System.out.println("Enter an integer: ");

x[i]= in.nextInt

}

for (i=0;i<y;i++)

{

if(×[i]÷2!=0)

{

if(max<x[i])

{

max= x[i];

}

}

}

System.out.println("result"+max);

}

}

Similar questions