write a program to store n elements in an array and display only those array elements which are divisible by 5 or 6 where n is the size of an array.
Answers
Answered by
0
Answer:
import java.io.*;
class divisiblearray
{
public static void main(String args [ ] )
{
Scanner sc=new Scanner(System.in);
int a[ ] =new int [ 10 ];
System.out.println("Enter the Value in array");
for(int i=0;i<=10;i++)
{
a[i] = sc.nextInt();
}
System.out.println("The Value in array");
for(int i=0;i<=10;i++)
{
System.out.println(+a[i]+" " );
}
System.out.pirntln("The value which are divisible by 5 or 6 are:- ");
for(int i=0;i<=10;i++)
{
if(a[i]%5==0 | | a[i] %6==0)
{
System.out.println(+a[i]);
}
}
}
}
System.out.println(+a[i]+" " );
}
Similar questions
Math,
3 months ago
Social Sciences,
3 months ago
Math,
6 months ago
Physics,
6 months ago
Computer Science,
11 months ago