package findod;
import java.util.Scanner;
public class fiod {
public static void main(String[] args) {
int i;
int a[]=new int [10];
Scanner sc =new Scanner(System.in);
System.out.println("Enter the array");
for(i=0; i<10; i++)
{
a[i]=sc.nextInt();
}
for(i=0; i<10; i++)
{
System.out.println(a[i]);
}
for(i=0; i<10; i++)
{
if(a[i]%2!=0)
{
System.out.print("Element is at location: ");
System.out.println(i);
System.out.print("Element is: ");
System.out.println(a[i]);
}
}
}
}
import java.util.Scanner;
public class fiod {
public static void main(String[] args) {
int i;
int a[]=new int [10];
Scanner sc =new Scanner(System.in);
System.out.println("Enter the array");
for(i=0; i<10; i++)
{
a[i]=sc.nextInt();
}
for(i=0; i<10; i++)
{
System.out.println(a[i]);
}
for(i=0; i<10; i++)
{
if(a[i]%2!=0)
{
System.out.print("Element is at location: ");
System.out.println(i);
System.out.print("Element is: ");
System.out.println(a[i]);
}
}
}
}
No comments:
Post a Comment