# data[].attributes.body
import java.util.*;
class Magic
{
static Scanner sc= new Scanner(System.in);
/** data members */
int Arr[], size;
/** parameterised constructor */
Magic(int x)
{
size=x;
Arr= new int[size];
}
/** function to input array elements */
void input()
{
System.out.println("Enter array elements:");
for(int i=0;i<size;i++)
{
Arr[i]= sc.nextInt();
}
}
/** function to compute and return sum of digits */
int sum_of_digits(int x)
{
int sum=0;
while(x!=0)
{
sum= sum+(x%10);
x=x/10;
}
return sum;
}
/** function to return true if number is magic else return false */
boolean isMagic(int n)
{
int s= sum_of_digits(n);
while(s>9)
{
s= sum_of_digits(s);
}
if(s==1)
return true;
return false;
}
/** function to display all magic numbvers of given array */
void show()
{
System.out.println("Magic numbers are:");
for(int i=0;i<size;i++)
{
if(isMagic(Arr[i])==true)
System.out.print(Arr[i]+" ");
}
}
/** main function to create object and call functions */
public static void main()
{
System.out.println("Enter the size of the array:");
int a= sc.nextInt();
Magic ob= new Magic(a);
ob.input();
ob.show();
}
}

# data[].attributes.body
import java.util.*;
class Magic
{
int arr[ ] ;
int size;

magic ( int x)
{
size = x;
arr [ ] = new int [ size ];
}
void input ()
{
System.out.println("ENTER THE NUMBER" );
for ( int i=0 ; i<size ; i++ )
{
arr [i] = sc.nextInt() ;
}
}
int sumofdigits (int x)
{
int s = 0;
while ( x>0 )
{
s = s + x%10;
x = x/10;
}
return s;
}
boolean ismagic ( int n )
{
while ( n > 9 )
{
n = sumofdigits(n)
}
if (n == 1) return true ;
else return false;
}
void show ( )
{
for ( int i=0 ; i<5 ; i++ )
{
if ( ismagic ( arr [ i ] ) == true );
System.out.println( arr [ i ]);

}
public static void main (String args [])
{
Scanner sc= new Scanner ( System.in) ;
int x=sc.nextInt();
magic ob=new magic(x);
ob.input();
ob.show();
}
}

# data[].attributes.body
Int sum of digits(int x)
{
Int sum=0;
While(x!=0)
{
Int digit=x%10;
Sum= sum +digit;
x=x/10;
}
return sum;
}
boolean ismagic(int n)
{
while(n>9)
{
n=sumofdigit(n);
}
If(n=1)
return true;
else
return false;
}

# data[].attributes.body
import java.util.*;
class sort
{
static Scanner sc= new Scanner(System.in);
int arr[], size, small, big;

sort(int n)
{
size=n;
arr= new int[size];
small=big=0;
}

void input()
{
int i;
System.out.println("Enter the array elements: ");
for(i=0; i<size; i++)
{
arr[i]= sc.nextInt();
}
}

void smallest()
{
small= arr[0];
for(int i=1; i<size; i++)
{
if(arr[i]<small)
small= arr[i];
}
}

void biggest()
{
big= arr[0];
for(int i=1; i<size; i++)
{
if(arr[i]>big)
big= arr[i];
}
}

void arrange()
{
for(int i= small; i<=big; i++)
{
for(int j=0; j<size; j++)
{
if(arr[j]==i)
System.out.println(arr[j]+"\t");
}
}
}
public static void main()
{
System.out.println("Enter the size of the array");
int x= sc.nextInt();
sort ob= new sort(x);
ob.input();
ob.biggest();
ob.smallest();
}
}

# data[].attributes.body
import java.util.*;

class perfectarr

{

void printperfect ()

{

int i, ar=new int [10];

Scanner sc=new Scanner (System.in);

System.out. println(“Enter array element”);

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

{

ar[i]= sc.nextInt();

}

System.out. println(“Perfect numbers”);

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

{

int r=sumfactor (arr[i]);

if (r==ar[i])

System.out. println (ar[i])

}

}

int sumfactor (int a)

{

int s=0;

for (int i=1; i<a/2; i++)

{

if (a%i==0)

s=s+i;

}

return s;

}

}

# data[].attributes.body
import java.util.*;
class perfectarr
{
void perfectarr()
{
int ar[]= new int[10], i;
Scanner sc= new Scanner(System.in);
System.out.println("Enter array elements");
for(i= 0; i<10; i++)
{
ar[i]= sc.nextInt();
}
System.out.println("Perfect Numbers");
for(i=0; i<10; i++)
{
int r= sumfactor(ar[i]);
if(r==ar[i])
System.out.println(ar[i]);
}
}
int sumfactor(int a)
{
int s=0;
for(int i=1; i<=a/2; i++)
{
if(a%i==0)
s= s+i;
}
return s;
}
}

# data[].attributes.body
import java.util.*;
class perfectnum
{
static  Scanner sc= new Scanner(System.in);
void enter()
{
int arr[] = new int[10];   //creating array
int i,c=0;
System.out.println ("ENTER ARRAY ELEMENTS")
for (i=0;i<10;i++)
arr[i]= sc.nextInt();  //entering array  elements

System.out.println ("PERFECT NUMBERS ARE:" );
if (sumFactor(arr[i]) == arr[i])
{
System.out.println (arr[i]);
c++;
}
if (c=0)
System.out.println ("NO PERFECT NUMBER IS PRESENT IN ARRAY");
}

int sumFactor(int n)
{
int sum=0;
for (int i=1;i<=n/2;i++)
{
if (n%i==0)
sum=sum+i;
}
return sum;
}
}

# data[].attributes.body
Devojeet Diwakar

# data[].attributes.body
//SUBCLASS
import java.util.*;
public class Invoice extends Products
{
int qty,ndef;
double gst,totalamt;
public Invoice(int c,String n,double p,int q,int d)
{
super(c,n,p);
qty=q;
ndef=d;
gst=totalamt=0;
}
void calcValue()
{
gst=18.5/100*price*(qty-ndef);
totalamt=price*(qty-ndef)+gst;
}
void print()
{
super.print();
calcValue();
System.out.println("QUANTITY:"+qty);
System.out.println("DEFECTED PIECES:"+ndef);
System.out.println("TOTAL AMOUNT:"+totalamt);
}
static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter product code:");
int c=sc.nextInt();
System.out.println("Enter product name:");
String n=sc.nextLine();
System.out.println("Enter price of each product :");
double p=sc.nextDouble();
System.out.println("Enter quantity:");
int q=sc.nextInt();
System.out.println("Enter no.of defective pieces:");
int d=sc.nextInt();
Invoice ob=new Invoice(c,n,p,q,d);
ob.print();
}
}

# data[].attributes.body
SURYANSH MISHRA

# data[].attributes.body
SURYANSH MISHRA

# data[].attributes.body
SHIVANSH

# data[].attributes.body
//SUPER CLASS
public class Plane
{
int x1,x2,y1,y2;
public Plane(int a,int b,int c,int d)
{
x1=a;
x2=b;
y1=c;
y2=d;
}
double distance()
{
return Math.sqrt(Math.pow(x2-x1,2)+Math.pow(y2-y1,2));
}
void display()
{
System.out.println("Start point: ("+x1+","+y1+")");
System.out.println("End point: ("+x2+","+y2+")");
}
}
//SUB CLASS

import java.util.*;
public class Calculate extends Plane
{
double dist,midx,midy;
public Calculate(int a,int b,int c,int d)
{
super(a,b,c,d);
dist=midx=midy=0;
}
void docalc()
{
dist=distance();
midx=(x1+x2)/2;
midy=(y1+y2)/2;
}
void display()
{
super.display();
docalc();
System.out.println("Distance="+dist);
System.out.println("Mid-point=("+midx+","+midy+")");
}
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the coordintes of one point:");
int a=sc.nextInt();
int c=sc.nextInt();
System.out.println("Enter the coordintes of second point:");
int b=sc.nextInt();
int d=sc.nextInt();
Calculate ob=new Calculate(a,b,c,d);
ob.display();
}
}

# data[].attributes.body
import java.util.*;
class arrangenum
{
int n;
int s[];
arrangenum(int nn)
{
n= nn;
//process to count the total number of digits of n
int len=0;
while(nn!=0)
{
len++;
nn= nn/10;
}
//allocate the memory for the array
s= new int[len];
}

void fillarray()
{
//extract each digit from the number n and store it in array
int i=0;
int q=n;
while (q!=0)
{
s[i]= q%10;
i++;
q= q/10;
}
}

void arrange()
{
//bubble sort method
for(int i=0; i<s.length; i++)
{
for(int j=0; j<s.length-1-i; j++)
{
if(s[j]>s[j+1])
{
int temp= s[j];
s[j]=s[j+1];
s[j+1]= temp;
}
}
}
}

void display()
{
System.out.println("Original Number: "+n);
System.out.println("Sorted Number: ");
for(int i=0; i<s.length; i++)
{
System.out.print(s[i]);
}
}

public static void main()
{
Scanner sc= new Scanner(System.in);
System.out.println("Enter a number; ");
int x= sc.nextInt();

arrangenum ob= new arrangenum(x);
ob.fillarray();
ob.arrange();
ob.display();
}
}

# data[].attributes.body
class ArrangeNum
{
int n;
int s[];
ArrangeNum (int nn)
{
n=nn;
}
void fillarray()
{
System.out.println ("Enter number:");
n=ob.nextInt();
int no=n,c=0;
while (no!=0);
{
n=n/10;
c++;  //counting number of digits in number
}
s=new int[c];
int i, nu=n,r;
while (nu!=0)
{
r=n%10;
s[i] = r;       //unsorted array
nu= nu/10;
}
void arrange()
{
int i, j,t;
for (i=0;i<s.length;i++)
{
for (j=0; j<s.length-1-i;j++)
{
if ( s[j]>s[j+1])
{
t=a[j];  //storing greater element in t
a[j]=a[j+1]; //swapping
a[j+1]=t;
}}}

void display ()
{
System.out.println ("Original number" +n);
System.out.print ("Sorted number:");
/**Printing array in ascending order*/
for (i=0;i<s.length;i++)
System.out.println (s[i]);
}}}

# data[].attributes.body
int s[ ] ;
/**parameterized constructor

# data[].attributes.body
import java.util.*;
public class SelectionSort
{
public static void main (String args[])
{
Scanner sc=new Scanner (System.in);
int arr[];
System.out.println("Input the length of the Array");
int len=sc.nextInt();
arr= new int[len];
int temp=0;
System.out.println("Input the Elements of the Array ");
for (int i=0;i<len;i++)
arr[i]=sc.nextInt();
for (int i=0;i<len-1;i++)
{
for (int j=i+1;j<len;j++)
{
if (arr[i]>arr[j])
{
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
}
}
System.out.println("The Sorted array is ");
for (int i=0;i<len;i++)
System.out.println(arr[i]);
}
}

# data[].attributes.headline
import java.util.*;class selection_sort{    public static void main()    {        Scanner sc= new Scanner(System.in);        int n=sc.nextInt();        int arr[]= new int[n];        for(int i=0; iarr[j])                {                    temp=arr[i];                    arr[i]=arr[j];                    arr[j]= temp;                }            }        }        for(int i=0;i

# data[].attributes.subject
import java.util.*;class selection_sort{    public static void main()    {        Scanner sc= new Scanner(System.in);        int n=sc.nextInt();        int arr[]= new int[n];        for(int i=0; iarr[j])                {                    temp=arr[i];                    arr[i]=arr[j];                    arr[j]= temp;                }            }        }        for(int i=0;i

# data[].attributes.body
is it correct ?
SHIVANSH

# data[].attributes.body
for(int i= 0; i<arr.length-1;i++)
{
int index=i,j;
for(j=1+i;j<arr.length;j++)
if(arr[j]<arr[index])
{
index=j;
}
}
int smallerNumber=arr[index];
arr[index]=arr[i];
arr[i]=smallerNumber;
}

# data[].attributes.headline
import java.util.*;class pgr{    public void main ()    {        Scanner sc=new Scanner(System.in);        int n =sc.nextInt();        int arr[]=new Int [n];        for (int i=0;i<=n;i++)        {            arr[i]=sc.nextInt ();        }        for (int j=0;j<=n;j++)        {                        for (int x=0;x

# data[].attributes.subject
import java.util.*;class pgr{    public void main ()    {        Scanner sc=new Scanner(System.in);        int n =sc.nextInt();        int arr[]=new Int [n];        for (int i=0;i<=n;i++)        {            arr[i]=sc.nextInt ();        }        for (int j=0;j<=n;j++)        {                        for (int x=0;x

# data[].attributes.body
~Abhimantra Rastogi

# data[].attributes.body
For(i=0;i<n-1;i++)
{
For(j=0;j<(n-i-1);j++)
{
If(arr[j-1]>arr[j])
{
t=arr[j-1];
arr[j-1]=arr[j];
arr[j]=t;
}
}
}

# data[].attributes.body
Shreya

# data[].attributes.body
Bubble sorting
import java.util.*;

class Dcoder
{
public static void main(String args[])
{
Scanner sc =new Scanner(System.in);
System.out.println("Enter the range of the array");
int n = sc.nextInt();
int ar[]= new int[n];
System.out.println("Enter array elements");
for(int i = 0;i<=n-1;i++)
{
ar[i]= sc.nextInt();
}
for(int  k = 0;k<n-1;k++)
{
for(int j = 0 ;j<=n-2;j++)
{
if(ar[j]<ar[j+1])
{
int x = ar[j];
ar[j]=ar[j+1];
ar[j+1]= x;
}
}
}
for(int m=0;m<=n;m++)
System.out.println("Modified array"+ ar[m]);
}
}

# data[].attributes.body
import java.util.*;
public class program1
{
public static void main (String args [])
{
Scanner sc = new Scanner (System.in) ;
int numbers[ ]= new int [size];
int max;
int min;
System.out.println(" Enter the size of the array ");
int size = sc.nextInt();
System.out.println("\n ENTERED ARRAY IS ");
for (int  i = 0; i<size; i++)
{
myArray[i]=sc.nextInt();
}
max= numbers[0];
min= numbers[0];

for(int i=1 ; i<n ; i++)
{
if( numbers[i] > max)
max= numbers[i];
if( numbers[i] < min)
min= numbers[i];
}
System.out.println("\n MINIMUM VALUE :" + max);
System.out.println("\n MAXIMUM VALUE :" + min);
}
}

# data[].attributes.body
import java.util.*;
public class Invoice extends Products
{
int quantity,def;
double gst,totalamt;
public Invoice(int c,String n,double p,int q,int d)
{
super(c,n,p);
quantity=q;
def=d;
gst=totalamt=0;
}
void calcValue()
{
gst=18.5/100*price*(quantity-def);
totalamt=price*(quantity-def)+gst;
}
void print()
{
super.print();
calcValue();
System.out.println("QUANTITY:"+ quantity);
System.out.println("DEFECTED PIECES:"+ def);
System.out.println("TOTAL AMOUNT:"+totalamt);
}

}

# data[].attributes.body
import java.util. *;
class big
{
public static void main()
{
Scanner sc= new Scanner(System.in);
int n=sc.nextInt();
int arr[] =new int[n];
for(int i=0;i<arr.length;i++)
{
arr[i]= sc.nextInt();
}
int max=arr[0];
int min=arr[0];
for(int i=0; i<arr.length; i++)
{
if(arr[i]>max)
max=arr[i];

if(arr[i]<min)
min=arr[i];
}
System.out.println("Max"+max +"\n Min"+min);
}
}

# data[].attributes.body
import java.util.*;
public class program1
{
public static void main (String args [])
{
Scanner sc = new Scanner (System.in) ;
int ar[ ]= new int [size];
System.out.println(" Enter the size of the array ");
int size = sc.nextInt();
int sum = 0;
int n ;
for (int  i = 0; i<size; i++)
{
myArray[i]=sc.nextInt();
}
for ( int i = 0 ; i<size; i++)
{
n= 0;
for ( int j= 1 ; j<  = ar[i] ; j++ )
if ar[i] % j ==0;
n++;
if n== 2;
sum = sum+ ar[ i ];
}
System.out.println("\n SUM OF THE ARRAY IS " + sum);
}
}

# data[].attributes.body
import java.util.*;
class maxArray
{
public static void main()
{
Scanner sc= new Scanner(System.in);

int ar[], n, i, min, max;
System.out.println("Enter the size of the array");
n= sc.nextInt();

ar= new int[n];
System.out.println("Enter the array elements");
for(i=0; i<n; i++)
ar[i]= sc.nextInt();

min=max=ar[0];
for(i=1; i<n; i++)
{
if (ar[i]>max)
max= ar[i];
if(ar[i]<min)
min= ar[i];
}
System.out.println("Largest element= "+max);
System.out.println("Smallest element= "+min);
}
}

# data[].attributes.body
Jaya Jaiswal

# data[].attributes.body
import java.util.*;
class abc
{
public static void main ()
{
Scanner sc=new Scanner(System.in);
int c=0,sum=0;
System.out.println("enter the size of array");
Int n=sc.nextInt();
Int a[ ] =new int[n];
System.out.println("enter  the elements ");
for(int i=0;i<n;i++)
{
a[i]=sc.nextInt();
}
for(int i=1;i<=a[i];i++)
{
If (a[i]%i==0)
{
c++;
sum=sum+a[i];
}
}
If(c==2)
{
System.out.prinltn("prime numbers="+a[i]);
System.out.prinltn("sum of prime numbers="+sum);
}
}