Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

import java.io.

*;

import java.util.Scanner;

//import java.util.Arrays;

class linearSearch{

public static void main(String[] args)

int [] N = new int[7];

N[1]= 45;

N[2]= 54;

N[3]= 74;

N[4]= 94;

N[5]= 78;

N[6]= 88;

N[7]= 90;

boolean FOUND;

int B,C;

B = 74;

FOUND=true;

C=0;

while ((C <= 7) && ((FOUND)))

{
if (A != N[A])

FOUND=false;

System.out.println( N[C] + " found at position " + A);

C=C--;

if (FOUND == true)

System.out.println(B + " not found ");

import java.util.Scanner;

public class Star {

public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);

// Input the number of rows

System.out.print("Enter the number of rows: ");

int rows = scanner.nextInt();

// Loop to print '*' with the corresponding number of rows


for (int i = 5; j <= row--; j++) {

for (int x = 1; x >= 1; x--)

System.out.print("* ");

System.out.println(); // Move to the next line for the next row

scanner.close(); // Close the scanner

You might also like