Computer Science, asked by samrata824, 4 months ago

Write a program to print all the 3 digit prime numbers. 17) Write a program to input 10 numbers. Input another number. If the number is present in the list then print "NUMBER FOUND" otherwise print " NUMBER NOT FOUND".

please answer this question with variable description and comment ​

Answers

Answered by BrainlyProgrammer
4

Question:-

  • Write a program to input 10 numbers. Input another number. If the number is present in the list then print "NUMBER FOUND" otherwise print " NUMBER NOT FOUND".

Code:-

package Coder;

import java.util.*;

class Code

{

public static void main (String ar [])

{

/*

*Code written by

*@swetank232894

*/

Scanner sc=new Scanner (System.in);

int a[]=new int[10];

System.out.println("Enter ten elements in an array");

int f=0;

for(int I=0;I<10;I++)

{

a[I]=sc.nextInt();

}

System.out.println("Enter number to be searched");

int n=sc.nextInt();

for(int i=0;i<10;i++)

{

if (n==a[i])

{

f=1;

break;

}

}

if(f==1)

System.out.println("Number found");

else

System.out.println("Number not found");

}

}

______

Variable Description:-

  1. I:- loop variable
  2. i:- loop variable
  3. f:- flag variable
  4. n:- to input the number to be searched
  5. a:- to store multiple numbers (10 numbers)

_______

Output attached

Attachments:
Similar questions