Posts

Showing posts from 2016

ICSE ISC 2017 ROUTINE DECLARED

The Council for the Indian School Certificate Examination has declared the Indian Certificate of Secondary Education (ICSE) Board Examination, and Indian School Certificate (ISC) Board Examination timetable for 2017. The ICSE Grade 10 examination will begin on February 27, 2017 and end on March 31, 2017. While, the ISC Class 12 board examination will begin on February 6 (with its practical examination) and get over on April 5, 2017. Most of the ICSE schools will begin their prelim examinations from this month to prepare students for the board examination. Last year the 10th class board examination began on February 29, 2016, it went on till March 31, 2016. Candidates can check a proper schedule of the examinaton on the CISCE site. Here's the  ICSE  and  ISC  link for the time table. http://www.cisce.org/notice_board.aspx http://www.cisce.org/notice_board.aspx http://www.cisce.org/notice_board.aspx

Anagrams In Java ISC ICSE CBSE Class 12

import java.util.*; class Anagram{     public static void main(){         String s;         Scanner sc=new Scanner(System.in);         System.out.println("Enter a word");         s=sc.next();         Anagram ob=new Anagram();         ob.display("",s);     }     public void display(String p,String w){         if(w.length()<=1)         System.out.println(p+w);         else{             for(int i=0;i<w.length();i++){             String a=w.substring(i,i+1);             String b=w.substring(0,i);             String c=w.substring(i+1);             display(p+a,b+c);         }     } ...

Encoding In Java ISC CBSE Class 12

import java.util.*; class Encode{     public static void main(){         Scanner sc=new Scanner(System.in);         String s,t="",str="",p;         int c,k,l;         System.out.println("Enter the code");         s=sc.next();         l=s.length();         if(l>200){             System.out.println("Invalid Code");             return;         }         for(int i=l-1;i>=0;i--){             c=s.charAt(i)-48;             c=9-c;             t=t+Integer.toString(c);         }         for(int j=0;j<=l;j+=2){             p=t.substring(j,j+2);       ...

Decoding In Java ISC CBSE Class 12

import java.util.*; class Decode{     public static void main(){         Scanner sc=new Scanner(System.in);         String str,s="";         int i,l,j,ss,r,sr=0;         System.out.println("Enter a sentence");         str=sc.nextLine();         l=str.length();         for(j=0;j<l;j++){                 if((str.charAt(j)>=65&&str.charAt(j)<=90)||(str.charAt(j)>=97&&str.charAt(j)<=122)||(str.charAt(j)==32)){                    s=s+(int)str.charAt(j);                 }//if             }//for j             ss=Integer.parseInt(s);             while(ss>0){       ...

Denomination Of Notes Currency In Java Isc Icse CBSE

import java.util.*; class Denomination{     public static void main(){      Scanner sc=new Scanner(System.in);      int n,nn,c=0,s=0,i;      int a[]={1000,500,100,50,20,10,5,2,1};         System.out.println("Enter a multidigit no.");          n=sc.nextInt();          nn=n;          if((n+"").length()>5){              System.exit(1);             }             else{             for(i=0;i<=8;i++){                 c=n/a[i];                 if(c!=0){                 System.out.println(a[i]+"  *  "+c+"      "+a[i]*c);           ...

Integer To Roman In Java ISC CBSE Class 12

class Roman{     public void accept(int n){      int c=0,i,j;      int a[]={1000,900,500,400,100,90,50,40,10,9,5,4,1};      String aa[]={"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};          if(n>9999){              System.exit(1);             }             else{             for(i=0;i<=12;i++){                 c=n/a[i];                 if(c!=0){                 for(j=1;j<=c;j++)                 System.out.print(aa[i]);             }                 n=n%a[i];             }     ...

Transpose Matrix In Java

//Transpose Matrix import java.util.*; class Matrix{     public static void main (){         Scanner sc=new Scanner(System.in);         int i,j,N;         System.out.println("Enter the value of N");         N=sc.nextInt();         int a[][]=new int[N][N];         for(i=0;i<N;i++){         for (j=0;j<N;j++){         System.out.println("Enter any number");         a[i][j]=sc.nextInt();     }}     for(i=0;i<N;i++){         for (j=0;j<N;j++){     System.out.print(a[i][j]); }System.out.println(); } } }

Magic Square In Java

import java.util.*; class MagicSquare{     public static void main(){         Scanner sc=new Scanner(System.in);         int n,x,i,j;         System.out.println("Enter size of an array");         n=sc.nextInt();         int a[][]=new int[n][n];         i=0;         j=(n-1)/2;         x=1;         do{             if(a[i][j]!=0){                 i=(i+2)%n;                 j=(j+1)%n;             }//end of if             a[i][j]=x++;             i--;             j--;             if(i<0)           ...

Delete Duplicate Elements In Java

import java.util.*; class Duplicate{     public int length1(int y[]){         int l,i,k,c=0,j;         l=y.length;         for(i=0;i<l;i++){         for(j=0;j<l;j++){             if(y[i]==y[j]){                 if(i<=j){                     c++;                     break;                 }//if                 else                 break;             }//if         }//for j     }//for i     return c; }//method public static void main(){   Scanner sc=new Scanner(System.in);   int i,j;   int a[]=new int[...

Decimal To Hexadecimal In Java

//DECIMAL TO HEXADECIMAL class Dec2Hex{     public void convert(int d){         char c=' ';         String s="";         int r;         while(d!=0){             r=d%16;             d=d/16;             if(r<10)             c=r>10?(char)(r+55):(char)(r+48);             s=c+s;         }         System.out.println(s);     }}         

Days To Date In Java

//DAYS TO DATE class daystodate{     private int a[]={31,28,31,30,31,30,31,31,30,31,30,31};     public void convert(int d,int y){         int m;         if(y%100!=0&&y%400==0||y%4==0)         a[1]=29;         else         a[0]=28;         for(m=0;d>a[m];m++){             d=d-a[m];         }         System.out.println("THE CORRECT DATE IS = "+d+"/"+(m+1)+"/"+y);     }}         

Date To Days In Java

//DATE TO DAYS class datetodays{     private int a[]={31,28,31,30,31,30,31,31,30,31,30,31};     public void convert(String str){         int d,m,y,i,s=0;         if(str.indexOf('/')!=2||str.lastIndexOf('/')!=5||str.length()!=10){             System.out.println("Invalid Date");             return;         }         d=Integer.parseInt(str.substring(0,2));         m=Integer.parseInt(str.substring(3,5));         y=Integer.parseInt(str.substring(6));         if(y%100!=0&&y%400==0||y%4==0)         a[1]=29;         else         a[1]=28;         s=d;         for(i=0;i<m-1;i++)         s=s+a[i];         System.o...

Vampire Number In Java

class Vampire{     public void check(){         int i,t;         for(i=1000;i<=9999;i++){             if(isvampire(i)==true)             System.out.println(i);         }}         private boolean isvampire(int n){             int i,j,l,k,x,y;             boolean b=false;             String s=""+n;             for(i=0;i<4;i++){                 for(j=0;j<4;j++){                     if(i==j)                     continue;                     for(k=0;k<4;k++){               ...

Check Date Valid In Java

//ACCEPT A DATE IN THE FORM DD/MM/YYYY AND CHECK IT IS VALID OR NOT import java.util.*; class CheckDate{     private String str;     private int m[]={31,28,31,30,31,30,31,31,30,31,30,31};     public void check(String str){         if(str.indexOf('/')!=2||str.lastIndexOf('/')!=5||str.length()!=10){             System.out.println("Invalid Date");             return;         }         int dd,mm,yy;         dd=Integer.parseInt(str.substring(0,2));         mm=Integer.parseInt(str.substring(3,5));         yy=Integer.parseInt(str.substring(6));         {if(yy%100!=0&&yy%400==0||yy%4==0)         m[1]=29;         else         m[1]=28;}         {if((mm>=1&...

Sort Boundary Elements Of A Matrix

ISC COMPUTER SCIENCE PRACTICALS 2009 BOUNDARY ELEMENTS Write a program to declare a matrix A[ ][ ] of order (m*n) where 'm' is the number of rows and n is the number of columns such that both m and n must be greater than 2 and less than 20. Allow the user to input positive integers into this matrix. Perform the following tasks on the matrix: (a) Sort the elements of the outer row and column elements in ascending order using any standard sorting technique. (b) Calculate the sum of the outer row and column elements. (c) Output the original matrix, rearranged matrix, and only the boundary elements of the rearranged array with their sum. Test your program for the following data and some random data. 1. Example : INPUT : M=3, N=3 1 7 4 8 2 5 6 3 9 OUTPUT : ORIGINAL MATRIX : 1 7 4 8 2 5 6 3 9 REARRANGED MATRIX : 1 3 4 9 2 5 8 7 6 BOUNDARY ELEMENTS : 1 3 9 8   4 5 7 6 SUM OF OUTER ROW AND OUTER COLUMN = 43     ISC COMPUTER SCIENCE PRACTICALS 2009 ...

Number To Word In Java

//NUMBER TO WORD class Number2Word{     private String a1[]={"Zero","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fiteen","Sixteen","Seventeen","Eighteen","Nineteen"};     private String a2[]={"Twenty","Thirty","Fourty","Fifty","Sixty","Seventy","Eighty","Ninety"};     public void display(int n){         if(n<=19)         f1(n);         else if(n<=99)         f2(n);         else         f3(n);     }     public void f1(int n){         System.out.println(a1[n]);     }     public void f2(int n){         int x,y;         x=n/10;         y=n%10;         if(y==0)         System.out.println(a2[x-2]);...

Recursive program on Tower of Hanoi

Recursive program on Tower of Hanoi. import java.util.*; class TowerHRec {     public static void main(String args[])     {         int n;         char beg='A',aux='B',end='C';         Scanner sc=new Scanner(System.in);         System.out.println("Enter number of disks:");         n=sc.nextInt();         TowerHRec obj=new TowerHRec();         obj.move(n,beg,aux,end);     }     void move(int n,char beg,char aux,char end)     {         if(n==1)           System.out.println("Move "+n+" disks from "+beg+" -> "+end);                   else         {             move(n-1,beg,end,aux);             System.out.printl...

Queue Implement Array

Queue data structure using Array. import java.util.*; class arrayQueue {     protected int Queue[] ;     protected int front, rear, size, len;     //Constructor     public arrayQueue(int n)     {         size = n;         len = 0;         Queue = new int[size];         front = -1;         rear = -1;     }       //Function to check if queue is empty     public boolean isEmpty()     {         return front == -1;     }       //Function to check if queue is full     public boolean isFull()     {         return front==0 && rear == size -1 ;     }       //Function to get the size of the queue     public int getSize()     {    ...

Implement Stack data structure using Array.

Implement Stack data structure using Array. import java.util.*; class Stack1 {     int s[],max,top;     public static void main()     {         int ch,size;         Scanner sc =new Scanner(System.in);         System.out.println("Enter the size of the stack");         size=sc.nextInt();         Stack1 obj=new Stack1();         obj.assign(size);         while(true)         {             System.out.println("1:PUSH\n2:POP\n3:DISPLAY\n4:EXIT");             System.out.println("Enter your choice");             ch=sc.nextInt();             switch(ch)             {                 case 1: System.out.pr...

Evil Number In Java

Write a Program in Java to input a number and display the Evil Numbers from 1 to 50. import java.util.*; class EvilNumber {     String toBinary(int n) // Function to convert a number to Binary     {         int r;         String s="";         char dig[]={'0','1'};         while(n>0)             {                 r=n%2; //finding remainder by dividing the number by 2                 s=dig[r]+s;                 n=n/2;             }         return s;     }//toBinary         int countOne(String s)     {         int c = 0, l = s.length();         char ch;         for(int...

Coordinates And Point In Java

Write a menu driven program to perform the following using objects of the same class: i)distance of a given point from the origin ii)distance between two given points iii)coordinates of the midpoint of a line joining two points import java .util.*; class Point { double x,y;   public Point()   {x=0;    y=0;   }   public Point(double a,double b)   {x=a;    y=b;   }   public double distance(Point ob)   {double d;    d=Math.sqrt((Math.pow((this.x-ob.x),2))+(Math.pow((this.y-ob.y),2)));     return d;   }//end of distance()    public double disfromOrigin()   {double dis;    dis=Math.sqrt(x*x+y*y);      return dis;   }    public Point mid(Point ob)   {Point m;    m=new Point();    m.x=(ob.x+this.x)/2;    m.y=(ob.y+this.y)/2;    return m;   }//end of mid()   public stat...

Form Palindrome In Java

Take two positive integer of two digits or more, reverse the digits, and add to the original number. This is the operation of the reverse-then-add-sequence. Now repeat the procedure with the sum so obtained until a palindromic number is obtained. import java.util.*; class Reverse_sequence { public static boolean isPalindrome(int n)   { int d,r=0,p=n;    while(p!=0)    { d=p%10;      r=r*10+d;      p=p/10;    }     if (r==n)      return true;     else     return false;  }//end of fucntion isPalindrome  public static int reverse(int n)  { int m=n,d=0;    while(m!=0)    { d=d*10+(m%10);      m=m/10;    }    return d;  }  public static void main()  {  int n,s;     Scanner sc= new Scanner (System.in);     System.out.println("Enter a no.");   ...

Complex Number Operations In Java

To design a class Complex to represent operations on Complex numbers,ie. Addition, subtraction, modulus, conjugate, multiplication, division using objects of the same class. import java.util.*; class Complex { double r,i;     public Complex()     {r=0;      i=0;     }     public Complex(double a,double b)     {r=a;      i=b;     }     public double mod()     { return Math.sqrt(r*r+i*i);}     public Complex conju()     {Complex ob= new Complex();      ob.r=this.r;      ob.i=-this.i;      return ob;     }     public Complex sum(Complex ob)    { Complex xy= new Complex();       xy.r=this.r+ob.r;       xy.i=this.i+ob.i;       return xy;    }//end of sum()     public Complex dif(Complex ob)   ...

Mobius function In Java

Write a program in Java to find the value of Mobius function of a user input number. import java.util.*; class MobiusFn {     int n;         MobiusFn()     {         n = 0;     }         void input()     {         Scanner sc = new Scanner(System.in);           System.out.print("Enter a number : ");         n = sc.nextInt();     }         /*  The function primefac() either returns '0' if prime factors are repeated      *  or returns the no.of prime factors */     int primeFac()     {         int a=n, i=2, m=0, c=0, f=0;                     while(a > 1) // loop to generate prime factors         {           ...

Fascinating Number In Java

Write a program to input a number and check whether it is a Fascinating Number or not      within the range 100 to 3000. import java.util.*; class FascinatingNumber {     boolean isUnique(String q)     {         int A[] = {0,0,0,0,0,0,0,0,0,0}; //to store frequency of every digit from '0' to '9'         int i, flag = 0;         char ch;         for(i=0; i<q.length(); i++)         {             ch = q.charAt(i);             A[ch-48]++;         }         for(i=1; i<10; i++)         {             if(A[i]!=1)             {                 flag = 1; //flag is set to 1 if frequency is not 1       ...

Amicable Number In Java

Amicable numbers are two different numbers so related that the sum of the proper divisors of each is equal to the other number. Write a program in Java to find out the given two numbers are amicable or not. class amicable {  static int a,b;  static void input(int m,int n)  {      a=m;      b=n;      display();     }//input     static boolean check()     {         int s=0,i;         for(i=1;i<a;i++)         {             if(a%i==0)             {                 s=s+i;             }         }         if(s==b)         {             s=0;             for(i=1;i<b;i++) ...

Anagram in Java

Write a Program in Java to input a word and print its anagrams. import java.util.*; class Anagrams {     int c = 0;         void input()     {         Scanner sc = new Scanner(System.in);         System.out.print("Enter a word : ");         String s = sc.next();         System.out.println("The Anagrams are : ");         display("",s);         System.out.println("Total Number of Anagrams = "+c);     }//input       void display(String s1, String s2)     {         if(s2.length()<=1)         {             c++;             System.out.println(s1+s2);         }         else         {         ...

Consecutive letters in a sentence in Java

Write a program to print the consecutive letters in a sentence. Both input and output      are considered in uppercase. import java.util.*; class Consecutive{     public static void main(){         Scanner sc=new Scanner(System.in);         String str,s="";         int i,l,j;         System.out.println("Enter a sentence");         str=sc.nextLine();         str=str.toUpperCase();         l=str.length();         for(i=65;i<=90;i++){             for(j=0;j<l;j++){                 if(str.charAt(j)==i){                     s=s+str.charAt(j);                     break;               ...

Infix To Postfix In Java Using Stack

25--- Write a program to convert a given infix expression to postfix expression using stack. import java.util.*; import java.util.*; class Infix2Postfix {  char s[]=new char[100];     int top=-1;     void push(char ch){         top=top+1;         s[top]=ch;     }     char pop(){         char ch;         ch=s[top];         top=top-1;         return(ch);     }     int pre(char ch){         switch(ch){             case'^':return 3;             case'*':return 2;             case'/':return 2;             case'+':return 1;             case'-':return 1;         }         return 0; ...

Hit the nail on the head program in Java

24---Write a program to read a sentence which terminates with a full stop(.).The words are to          be sperated by a single blank space and are in lower case.Arrange the words in ascending          order according to the length of the words.If 2 words are of same length then the word          occuring first in the input sentence should come first.For for input and output the          sentence must begin with   upper case.          SAMPLE INPUT : Hit the nail on the head.          SAMPLE OUTPUT : On hit the the nail head. import java.util.*; class LengthWise{     public static void main()     {Scanner sc=new Scanner(System.in);         String s,t,x="",y;         int i,l;         System.out.println("Enter a String");       ...

Date difference in Java

23---WAP to perform date difference.Accept 2 dates in  the format dd/mm/yy.          check the dates are valid or not and find difference between 2 dates.          SAMPLE INPUT         Date 1:20/12/2012                               Date 2:11/02/2013          SAMPLE OUTPUT     Difference=54 days import java.util.*; class Date_Difference {     Scanner sc=new Scanner(System.in); int month[]={0,31,28,31,30,31,30,31,31,30,31,30,31}; //function for checking for Leap Year int isLeap(int y)     {         if((y%400==0) || ((y%100!=0)&&(y%4==0)))             return 29;         else             return 28;     } //function for checking date validation boole...

Wap to input an integer array of order m*n and arrange them along the ROW

22---Wap to input an integer array of order m*n and arrange them along the         ROW in a way given below.         SAMPLE INPUT                                           SAMPLE OUTPUT         3 2 4 1 5                                                       5 3 1 2 4         4 5 7 9 0                                                       9 5 0 4 7 import java.util.*; class Pendulum_Array {     public static void main()     {         Scanner sc=new Scanner(System.in);       ...

Union of 2 sets,A and B(2)Intersection of 2 sets,A and B.(3)Show that operation A-B and B-A are always false for sets.

21---Program to perform.         (1)Union of 2 sets,A and B.          (2)Intersection of 2 sets,A and B.          (3)Show that operation A-B and B-A are always false for sets. import java.util.*; class U_I_M {    private int l1,l2;    public void intersection(int a[],int b[]){        int i,j,k=0,l3;        l1=a.length;        l2=b.length;        l3=Math.min(l1,l2);        int c[]=new int[l3];        for(i=0;i<l1;i++){            for(j=0;j<l2;j++){                if(a[i]==b[j]){                    c[k++]=a[i];                    break;               ...