Class 10 Computer Assignment
Class 10 Computer Assignment
Class 10 Computer Assignment
CLASS X
1. Write a program to accept 10 different numbers in a Single Dimensional Array. Now, enter a
number and search whether the number is present or not in the list of array elements by
using the Linear search technique. If the number is present then display the message
“Search Successful” otherwise, display “Search Unsuccessful”.
2. Write a program to accept 10 different numbers in a Single Dimensional Array. Now, enter a
number and search whether the number is present or not in the list of array elements by
using the Linear search technique. If the number is present then display the number and its
position in the array.
3. Write a program to store the first 10 terms of the Fibonacci series in a Single Dimension
Array (SDA) and display the series from the array.
4. Write a program to accept 10 mobile numbers in a Single Dimensional Array. Now, search
the phone numbers, using the first 4 digits entered by the user from the array elements and
display.
5. Write a program to accept a set of 10 integers in a Single Dimensional Array (SDA). Sort the
numbers in ascending order by using the ‘Bubble Sort’ technique. Display the sorted array.
import java.util.*;
class bubble
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int i, j,temp;
int arr[]=new int[10];
for(i=0;i<10;i++)
{
System.out.println("enter the data");
arr[i]=sc.nextInt();
}
System.out.println("the unsorted array is :-");
for(i=0;i<10;i++)
{
System.out.print(arr[i]+" ");
}
for(i=0;i<9;i++)
{
for(j=0;j<(9-i);j++)
{
if(arr[j]>arr[j+1])
{
temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
}
}
}
System.out.println();
System.out.println("the sorted array is :-");
for(i=0;i<10;i++)
{
System.out.print(arr[i]+" ");
}
}
}