0% found this document useful (0 votes)
4 views5 pages

Mock Prog (Some)

Uploaded by

Mahesh k
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

Mock Prog (Some)

Uploaded by

Mahesh k
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

package com.

String;

public class AllInOne


{
// static String Reverse(String str) //reverse a string
// {
// String reve = "";
//
// for(int i = str.length()-1; i>=0;i--)
// {
// reve = reve+str.charAt(i);
// }
// return reve;
//
// }
// public static void main(String[] args)
// {
// String x = Reverse("JAVA");
// System.out.println(x);
// }

// static String Palindrome(String str) ///Reverse Palindrome


// {
// String rev = "";
//
// for(int i=str.length()-1;i>=0;i--)
// {
// rev+=str.charAt(i);
// }
// if(str.equals(rev))
// {
// return("Its a Palindrome");
// }
// else
// {
// return("Its not a Palindrome");
// }
// }
// public static void main(String[] args) {
// String x = Palindrome("MOM");
// System.out.println(x);
// }

// public static void main(String[] args) ///remove extra space


// {
// String str = "12A58D84I65T454YA";
// System.out.println(str.replaceAll("[^a-z A-Z]", ""));
//
// }

// public static void main(String[] args) { ///vowel count


//
// String str = "Helloo";
//
// int count = 0;
//
// for(int i = 0;i<str.length();i++)
// {
// char ch = str.charAt(i);
//
// if(ch == 'a'|| ch == 'e'|| ch == 'i'|| ch == 'o'|| ch == 'u')
// {
// count ++;
// }
// }
// System.out.println(count);
//
// }

// public static void main(String[] args) ///consonent count


//
// {
// String str = "aditya";
//
// int count = 0;
//
// for(int i = 0;i<str.length();i++)
// {
// char ch = str.charAt(i);
//
// if(ch != 'a'&& ch != 'e'&& ch != 'i'&& ch != 'o'&& ch != 'u')
// {
// count ++;
// }
// }
// System.out.println(count);
//
// }

// public static void main(String[] args) ///wihtout charAt meth


rev
// {
// String str = "JAVA";
//
// char [] ch = str.toCharArray();
//
// for(int i =ch.length-1; i>=0; i--)
// {
// System.out.print(ch[i]);
// }
// }

// public static void main(String[] args) //reverse without charAt


meth
// {
// String str = "AppA";
//
// String rev ="";
//
// char [] ch = str.toCharArray();
//
// for(int i=ch.length-1;i>=0;i--)
// {
// rev =rev+ch[i];
//
// }
// if(str.equals(rev)) {
// System.out.println("Palindrom");
// }
// else
// {
// System.out.println("Not Palindrom");
// }
//
// }

// public static void main(String[] args) { //print given string


// String str = "L$e@v_El";
// str=str.replaceAll("[^a-z A-Z]", "");
// char[]ch = str.toCharArray();
//
// String rev ="";
// for(int i=ch.length-1;i>=0;i--)
// {
// rev= rev+ch[i];
// }
// if(str.equalsIgnoreCase(rev))
// {
// System.out.println("Its a Palindrome");
// }
// else
// {
// System.out.println("Its not a Palindrome");
// }
// }

// static int numsum(int no) ///happy number


// {
// int sum = 0;
// while(no!=0)
// {
// int rem = no%10;
// sum = sum+(rem*rem);
//
// no=no/10;
// }
// return sum;
// }
// public static void main(String[] args) {
// int no = 13;
// while(no>9)
// {
// no = numsum(no);
// }
// if(no ==1 || no ==7)
// {
// System.out.println("Happy Number");
// }
// else
// {
// System.out.println("Not happy Number");
// }
// }

// public static void main(String[] args) { ///next prime number


//
// int n= 3;
// for(int j=n+1; j<=100;j++)
// {
// int no = j;
// boolean flag = true;
//
// for(int i=2;i<no;i++)
// {
// if(no%i==0)
// {
// flag = false;
// break;
// }
// }
// if(flag)
// {
// System.out.println(no + " is a Prime No");
// break;
// }
// }
//
//
// }

// public static void main(String[] args) { ///sum of array


//
// int sum = 0;
// int [] arr = {1,2,3,4,5};
// for(int i = arr.length;i>=0;i--)
// {
// sum = sum+i;
// }
// System.out.println(sum);
// }

// public static void main(String[] args) { ///


// int sum = 0;
// int arr[] = {1,2,3,4,5};
//
// for(int i= arr.length;i>=0;i--)
// {
// if(i%2==0)
// {
// sum = sum+i;
//
// }
// System.out.println(i);
// }
// }
//

You might also like