These are the only instructions I'm given. This is intended to be one assignment. We are only allowed to use 'for' loops. Thanks for your help.
Using Java:
Instructions:
Only use for loops for this lab (no need to create methods or classes for this assignment). Put comment on each line of your codes, explaining what each line of code does.
/* Below is your required java program using only for loops*/
import java.util.Scanner;/*import for taking input*/
public class Main
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);/* Object for input */
int a[]=new int[10];
System.out.println("Enter 10 integers:");
for(int i=0;i<10;i++)
a[i]=sc.nextInt();/* Enteer integers*/
System.out.println("Prime Numbers are ");
for(int i=0;i<10;i++){
boolean b=true;
if(a[i]<=1)
b=false;
else{
label: for(int j=2;j<a[i];j++){/* Check prime number condition
for each array element*/
if(a[i]%j==0){/* If true set boolean to false*/
b=false;
break label;
}
}
if(b==true)/* If true then print it*/
System.out.print(a[i]+" ");
}
}
}
}

These are the only instructions I'm given. This is intended to be one assignment. We are...