JAVA ASSIGNMENT NO-4 1)wap to input a no and check it is a prime or not import java .io.*; class prime { int n; prime(int t) { n=t; } void cal() { int i,c=0; for(i=2;i<n;i++) { if(n%i==0) { c=c+1; break; } } if(c==1) System.out.println("not prime"); else System.out.println("prime"); } } class cont { public static void main(String arg[]) { prime s=new prime(7); s.cal(); } } 2)wap to iput a no and check it is automorphic or not import java .io.*; class prime { int n,y,g; prime(int t) { n=t; //storing value of n in y y=n; int i=1,c=0,d; while(n>0) { d=n%10; if(d>1) { c=d*i; //here we get the value of first no of digit*(0) according to no of digit } n=n/10; i=i*10; //every time multiply by 10 } g=(y-c)*(y-c);//ex (749-700) we wil get the no leaving first no if(
If you’re too cute to be single! then date me :--