Vous êtes sur la page 1sur 19

class isc2013

{
void main(String s)
{
s=s.toLowerCase();
s=s+" ";
int l=s.length();
int c=0;
int p=0;
for(int i=0;i<l;i++)
{
String st2="";
String st3="";
char x=s.charAt(i);
if(x==' ')
{
p=i;
char y=s.charAt(c);
char z=s.charAt(p-1);
st2=s.substring(c+1,p-1);
st3=z+st2+y;
System.out.print(st3+" ");
c=p+1;
}
}
}
}


class pseudopal
{
void main(String s)
{
int l=s.length();
String st1="";
String st2="";
int flag=0;
for(int i=0;i<l;i++)
{
String st3="",st4="";
char x=s.charAt(i);
st1=s.substring(0,i);
st2=s.substring(i+1,l);
st3=st1+st2;
int t=st3.length();
for(int j=t-1;j>=0;j--)
{
char y=st3.charAt(j);
st4+=y;
}
if(st4.equals(st3))
{
System.out.println("YES");
flag=1;
break;
}
}
if(flag==0)
System.out.print("NO");
}
}

class novowel
{
void main(String s)
{
s=s.toLowerCase();
s=s+" ";
String st="";
int c=0;
int k=0;
int l=s.length();
for(int i=0;i<l;i++)
{
char x=s.charAt(i);
if(x!=' ')
st+=x;
else
{
int l2=st.length(); // program to accept a string and print the words which do not contain any
vowels
for(int j=0;j<l2;j++)
{
char y=st.charAt(j);
if(y=='a'||y=='e'||y=='i'||y=='o'||y=='u')
c++;
}
if(c==0)
{
k++;
System.out.println(st+" ");

}
st="";
c=0;

}
}
if(k==0)
System.out.println("All words contain a vowel");
}
}





class pseudoperfect
{
void main(int n)
{
int s=0,j=0,c=0,flag=0,yy=0;
for(int i=1;i<n;i++)
{
if(n%i==0)
{
s=s+i;
j++;
}
}
int a[]=new int[j];
for(int i=1;i<n;i++)
{

if(n%i==0)
{
a[c]=i;
c++;
}
}
for(int i=0;i<j;i++)
{
yy=s-n;
for(int h=i;h<j;h++)
{
if(yy==a[h])
n=1;
}
if(n==1)
{
s=s-yy;
if(s==n)
{
flag=1;
System.out.print("Mega Pseudo");
break;
}
}
if(flag==1)
break;
else
{
s=s-a[i];
if(s==n)
{
flag=1;
System.out.print("Mega Pseudo");
break;
}
}

}
if(flag==0)
System.out.print("Not");

}
}





class dd220414
{
void main()
{
int s=0;
int diff=0;
for(int i=10;i<=1000;i++)
{
int copy=i;
int d=0;
int r=0;
while(copy>0)
{
r=copy%10;
d=d*10+r; // d1 no.s are no.s which when added to their reverse and subtracted from their
reverse( absolute value) give a perfect square
copy/=10;
}
s=i+d;
diff=(int)Math.abs(i-d);
if(Math.sqrt(s)==(int)Math.sqrt(s) &&Math.sqrt(diff)==(int)Math.sqrt(diff))
System.out.println(i);
}
}
}



class dd230414
{
void main()
{
int p1=1,p2=1;
for(int i=10;i<=99;i++)
{
if(i%11==0)
continue;
else
{
int d=0,r=0,copy=i;
while(copy>0)
{
r=copy%10;
d=(d*10)+r;
copy/=10;
}

for(int j=i+1;j<=99;j++)
{
if(j%11==0)
continue;
else
{
int d1=0,r1=0,copy1=j;
while(copy1>0)
{
r=copy%10;
d1=(d1*10)+r;
copy1/=10;
}

if(i!=d1 && j!=d)
{
p1=i*j;
p2=d*d1;
if(p1==p2 && i<d && i<d1)
System.out.println(i+"*"+j+"="+d+"*"+d1);
}
}
}
}
}
}
}



class dd050814
{
void main(int n)
{
for(int i=1;i<=n+1;i++)
{
for(int j=i;j<=n;j++)
System.out.print(" ");
System.out.print("*");
for(int k=1;k<=i-1;k++)
System.out.print((char)(64+k));
for(int l=i-2;l>=1;l--)
System.out.print((char)(64+l));
if(i!=1)
System.out.print("*");
for(int m=n;m>=i;m--)
System.out.print(" ");

for(int j=i;j<=n;j++)
System.out.print(" ");
System.out.print("*");
for(int k=1;k<=i-1;k++)
System.out.print((char)(64+k));
for(int l=i-2;l>=1;l--)
System.out.print((char)(64+l));
if(i!=1)
System.out.print("*");
System.out.println();
}
for(int i=n;i>=1;i--)
{
int y=i-1;
int z=i-2;
for(int j=(n+1)-i;j>=1;j--)
System.out.print(" ");
System.out.print("*");
for(int k=1;k<=y;k++)
System.out.print((char)(64+k));
for(int l=z;l>=1;l--)
System.out.print((char)(64+l));
if(i!=1)
System.out.print("*");
for(int j=(n+1)-i;j>=1;j--)
System.out.print(" ");

for(int j=(n+1)-i;j>=1;j--)
System.out.print(" ");
System.out.print("*");
for(int k=1;k<=y;k++)
System.out.print((char)(64+k));
for(int l=z;l>=1;l--)
System.out.print((char)(64+l));
if(i!=1)
System.out.print("*");
System.out.println();
}
}
}



class dd170614
{
void main(int n)
{
int copy=0,r=0,c=0,st=0,st1=0,j=0;
while(copy>0)
{
r=copy%10;
c++;
copy/=10;
}
j=(int)(Math.pow(10,(c-1)));
for(int i=c-1;i>=1;i--)
{
st=n%(int)(Math.pow(10,i));
st1=n/j;
j/=10;
System.out.print(st);
System.out.print(st1);
System.out.println();
}
System.out.println(n);
}
}



import java.io.*;
class dd170714
{
void main() throws IOException
{
BufferedReaderbr=new BufferedReader(new InputStreamReader(System.in));
int st1=0,st2=0,p1=0,p2=0,max=0,c=0;
System.out.print("Enter the length of the array");
int n=Integer.parseInt(br.readLine());
int a[]=new int[n];
int l=a.length;
for(int i=0;i<l;i++)
{
System.out.println("Enter number in array");
a[i]=Integer.parseInt(br.readLine());
}
for(int i=0;i<l;i++)
{
if(a[i]==0)
c++;
if(a[i]==0)
{ // program to print the numbers on either side of the maximum successive zeroes
st1=a[i-c];
if(a[i+1]!=0)
st2=a[i+1];
}
if(st1!=0 && st2!=0)
{
p1=st1;
p2=st2;
st1=0;
st2=0;
c=0;
}
}
System.out.println(p1+" "+p2);
}
}









class dd060814
{
void main(int n)
{
int y=n-2;
int z=1;

for(int i=1;i<=(n+1)/2;i++)
{
for(int j=1;j<=i-1;j++)
System.out.print(" ");
System.out.print((char)(64+i));
for(int k=y;k>=1;k--)
System.out.print(" ");
y-=2;
if(i!=((n+1)/2))
System.out.print((char)(64+i));
System.out.println();
}

for(int i=1;i<=(n-1)/2;i++)
{
for(int j=((n+1)/2)-2;j>=i;j--)
System.out.print(" ");
System.out.print((char)(64+((n+1)/2)+i));
for(int k=z;k>=1;k--)
System.out.print(" ");
z+=2;
System.out.print((char)(64+((n+1)/2)+i));
System.out.println();
}
}
}


class dd040814
{
void main(String s)
{
int l=s.length();
String st="",store="";
int c=0;
for(int i=0;i<l;i++)
{
char x=s.charAt(i);
st+=x;
if(x==' ' &&s.charAt(i+1)==' ')
{
for(int j=i+1;j<l;j++)
{
if(s.charAt(j)==' ')
c++;
else
break;
}
i=i+c;
c=0;
}
}
System.out.println(st);
int l1=st.length();
for(int k=0;k<l1;k++)
{
char x=s.charAt(k);
if(x!=' ')
store+=x;
else
{
int l2=store.length();
for(int p=0;p<l2;p++)
{
char y=store.charAt(p);
if(y=='a' || y=='e' || y=='i' || y=='o' || y=='u')
{
c++;
break;
}
}
if(c==0)
System.out.print(store);
store="";
}
}
}
}

Vous aimerez peut-être aussi