Go to Top

Friday, 27 May 2011

To print a pattern in Java

Question 13 : Write a program in Java to print the following pattern : 

1
22
333
4444
55555

Java Program : 


public class pattern_1
{
 public static void main()
 {
     int i,j;
     for(i=1;i<=5;i++)
     {
         for(j=i;j>=1;j--)
         {
             System.out.print(i);
            }
            System.out.print("\n");
        }
    }
}

Output : 


1
22
333
4444
55555

Note : Use the calculator and the notepad provided, at the top, to dry run the program.

133 comments:

  1. really helpfull

    ReplyDelete
  2. #####
    #@@@#
    #@@@#
    #@@@#
    #####
    please solve it

    ReplyDelete
  3. Hi Aman ! Here's your program. Be sure to contact me again through comments if there are any mistakes and like this blog on facebook. Visit the link below :

    http://icse-java.blogspot.com/2012/01/visitors-request-3.html

    ReplyDelete
  4. 1
    12
    123
    234
    3451
    45123 plzzz solve it

    ReplyDelete
    Replies
    1. There seems to be a problem with your pattern. Please review it and send it to me again at this e-mail address :

      icse.java.blogspot@gmail.com

      Delete
  5. tell me is there any way that i could low the graphics of a particular game so that i could play it on my computer because every tome i install a game it gave an error that pixel shader 2.0 not found.

    ReplyDelete
  6. write a program to print the first 20 no. of the following pattern:-
    1,3,6,11,20...

    ReplyDelete
    Replies
    1. Your question might be a bit wrong. Since difference between 1 & 3 = 2, 3 & 6 = 3, 6 & 11 = 5, 11 & 20 = 9 <===. The last term should be 18. Also please find out the next term of it if you can, because the next difference might be 9, if taking the odd number logic and 11 if taking the prime number logic. If you think that the question is right, please reply.

      Delete
    2. next term should be 37
      Logic:-
      main series:.......1....3....6......11......20......37.......70
      diff btwn elemnts:..2....3.....5.......9.......17......33
      diff btwn elmnts :.....1....2.......4......8........16......32
      in the last line next element is= 2*prev elemnt
      i hope wat ive written is understandable

      Delete
    3. import java.io.*;
      class LL
      {
      public static void main(String args[])throws IOException
      {
      BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
      System.out.println("Enter Number Limit ");
      int n=Integer.parseInt(br.readLine());
      int k=2;
      int l=3;
      System.out.print("1"+" "+"3"+" ");
      for(int i=1;i<=n;i++)
      {
      k+=Math.pow(2,i-1);
      l+=k;
      System.out.print(l+" ");
      }
      }
      }

      Delete
  7. how to print this:_

    1
    1 1
    1 2 1
    1 3 3 1
    1 4 6 4 1

    ReplyDelete
    Replies
    1. http://icse-java.blogspot.in/2012/02/visitors-request-6.html

      That's your program.

      Delete
  8. 1.W.A.P. to Calculate LCM of n numbers and HCM of n numbers using array.

    ReplyDelete
  9. w.a.p. to perform Linear Search.

    ReplyDelete
    Replies
    1. import java.io.*;
      public class LinearSearch
      {
      int Array[]=new int[10];
      int i,no,flag;
      InputStreamReader in = new InputStreamReader(System.in);
      BufferedReader br =new BufferedReader(in);
      public void accept()throws IOException
      {

      System.out.println("Enter 10 numbers");
      for(i=0;i<10;i++)
      {
      Array[i]=Integer.parseInt(br.readLine());
      }
      }
      public void search()throws IOException
      {
      flag=0;
      System.out.println("Enter the number you want to search");
      no=Integer.parseInt(br.readLine());
      for(i=0;i<10;i++)
      {
      if(no==Array[i])
      {
      flag=1;
      break;
      }
      }
      if(flag==1)
      System.out.println(no+" is found at position "+(i+1));
      else
      System.out.println("Search unsuccessful");
      }
      public void main() throws IOException
      {
      LinearSearch A=new LinearSearch();
      A.accept();
      A.search();
      }
      }

      Delete
  10. WAP to print
    55555
    4444
    333
    22
    1

    ReplyDelete
    Replies
    1. class deep
      {
      public static void main
      {int a=5
      for(int i=5;i>=5;i--)
      {
      for(int j=1;j>=;j--)
      {System.out.print(a);
      }system.out.println();a--;}}}

      Delete
    2. import java util.*;
      class pattern
      {
      public static void main(String arg[])
      {
      int i,n,j;
      n=1;
      for (i=5;i>=n;i--)
      {
      for(j=5;j>=i;j--)
      {
      System.out.print(j);
      }
      System.out. println(i);
      }
      }
      }

      Delete
  11. 1
    121
    12321
    1234321
    plz help me out with this!!

    ReplyDelete
  12. Replies
    1. import java.io.*;
      public class pattern
      {
      int r,c,a;
      public void main() throws IOException
      {
      InputStreamReader in=new InputStreamReader(System.in);
      BufferedReader br=new BufferedReader (in);
      System.out.println("Enter the no. of rows you want");
      a=Integer.parseInt(br.readLine());
      System.out.println();
      for(r=1;r<=a;r++)
      {
      for(c=1;c<=r;c++)
      System.out.print("1 " );
      System.out.println();
      }
      for(r=a-1;r>=1;r--)
      {
      for(c=1;c<=r;c++)
      System.out.print("1 ");
      System.out.println();
      }
      }
      }

      Delete
  13. print this pattern plzzz

    0
    01
    024
    0369
    0481216
    05101520
    061218243036
    07142128354249
    0816243240485664
    091827364554637281

    plzzzz solve it

    ReplyDelete
    Replies
    1. import java.io.*;
      public class pattern
      {
      int r,m,a;
      public void main() throws IOException
      {
      InputStreamReader in=new InputStreamReader(System.in);
      BufferedReader br=new BufferedReader (in);
      System.out.println("Enter the no. of rows you want");
      a=Integer.parseInt(br.readLine());
      System.out.println();
      for(r=1;r<=a;r++)
      {
      System.out.print("0");
      for(m=1;m<=r;m++)
      System.out.print(r*m);
      System.out.println();
      }
      }
      }

      Delete
    2. package logicalPrograms;
      import java.util.Scanner;

      public class Pattern2 {
      public static void main(String []args)
      {
      Scanner sc = new Scanner(System.in);

      System.out.println("How many table pattern you want : ");
      int num = sc.nextInt();
      for(int i=0;i<=num;i++)
      {
      int sum =0;
      for(int j=0;j<=i;j++)
      {
      System.out.print(sum);
      sum+=i;
      }
      System.out.println("\n");
      }
      }

      }

      Delete
  14. print
    123454321
    1234 4321
    123 321
    12 21
    1 1

    ReplyDelete
    Replies
    1. import java.io.*;
      public class pattern
      {
      public void main() throws IOException
      {
      InputStreamReader in = new InputStreamReader(System.in);
      BufferedReader br =new BufferedReader(in);
      int r,c,sp=2,s;
      System.out.println("Enter the no of rows you want");
      int n=Integer.parseInt(br.readLine());
      for(r=1;r<=n-1;r++)
      System.out.print(r+" ");
      for(r=n;r>=1;r--)
      System.out.print(r+" ");
      System.out.println();
      for(r=n-1;r>=1;r--)
      {
      for(c=1;c<=r;c++)
      System.out.print(c+" ");
      for(s=sp;s>=1;s--)
      System.out.print(" ");
      for(c=r;c>=1;c--)
      System.out.print(c+" ");
      System.out.println();
      sp=sp+4;
      }
      }
      }

      Delete
  15. pls solve this..

    ***********
    * *
    * *
    * *
    ***********

    ReplyDelete
  16. plz help to print this

    5432112345
    5432 2345
    543 345
    54 45
    5 5

    ReplyDelete
    Replies
    1. import java.io.*;
      public class pattern
      {public void main() throws IOException
      {
      InputStreamReader in = new InputStreamReader(System.in);
      BufferedReader br =new BufferedReader(in);
      int r,c,sp=0,s;
      System.out.println("Enter the no of rows you want");
      int n=Integer.parseInt(br.readLine());
      System.out.println();
      for(r=1;r<=n;r++)
      {
      for(c=n;c>=r;c--)
      System.out.print(c+" ");
      for(s=sp;s>=1;s--)
      System.out.print(" ");
      for(c=r;c<=n;c++)
      System.out.print(c+" ");
      System.out.println();
      sp=sp+4;
      }

      }
      }

      Delete
  17. *
    * * *
    * * * * *
    * * * * * * *
    * * * * *
    * * *
    *
    hey guys i need this to be printed can anyone solve this plssssssssss
    thanks in advance

    ReplyDelete
    Replies
    1. import java.io.*;
      public class pattern
      {
      int r,c;
      public void main() throws IOException
      {
      InputStreamReader in=new InputStreamReader(System.in);
      BufferedReader br=new BufferedReader (in);
      for(r=1;r<=4;r++)
      {
      for(c=1;c<=r;c++)
      System.out.print("* " );
      System.out.println();
      }
      for(r=3;r>=1;r--)
      {
      for(c=1;c<=r;c++)
      System.out.print("* ");
      System.out.println();
      }
      }
      }

      Delete
  18. How to print this?
    1
    121
    12321
    1234321
    123454321
    1234321
    12321
    121
    1
    This is when n=9.

    ReplyDelete
    Replies
    1. import java.io.*;
      public class pattern
      {
      public void main()throws IOException
      {
      int r,c,a;
      InputStreamReader in = new InputStreamReader(System.in);
      BufferedReader br =new BufferedReader(in);
      System.out.println("How many rows do you want?");
      a=Integer.parseInt(br.readLine());
      for(r=1;r<=a;r++)
      {
      for (c=1;c<=r;c++)
      System.out.print(c+" ");
      for(c=r-1;c>=1;c--)
      System.out.print(c+" ");
      System.out.println();
      }
      for(r=a-1;r>=1;r--)
      {
      for (c=1;c<=r;c++)
      System.out.print(c+" ");
      for(c=r-1;c>=1;c--)
      System.out.print(c+" ");
      System.out.println();
      }
      }
      }

      Delete
    2. Write a program to accept a string and perform the following based on user’s choice:
      1. Count and print no. of vowels
      2. Count and print no. of consonants
      3. Count and print no. of digits
      4. Count and print no. of words
      pls... solve it

      Delete
    3. W.A.P to print the following pattern:
      If n=5
      1
      121
      12321
      1234321
      123454321
      1234321
      12321
      121
      1
      pls.... solve this..

      Delete
    4. public class program7
      {
      public static void main ()
      {
      int loop_1,loop_2;
      for(loop_1=1;loop_1<=5;loop_1++)
      {
      for (loop_2=1;loop_2<=loop_1;loop_2++)
      System.out.print(loop_2);
      for(loop_2=loop_1-1;loop_2>=1;loop_2--)
      System.out.print(loop_2);
      System.out.println();
      }
      for(loop_1=5-1;loop_1>=1;loop_1--)
      {
      for (loop_2=1;loop_2<=loop_1;loop_2++)
      System.out.print(loop_2);
      for(loop_2=loop_1-1;loop_2>=1;loop_2--)
      System.out.print(loop_2);
      System.out.println();
      }
      }
      }

      Delete
  19. a1
    a2 b3
    a4 b5 c6
    a7 b8 c9 d10
    plz solve it..

    ReplyDelete
    Replies
    1. import java.io.*;
      public class pattern
      {
      public void main() throws IOException
      {
      InputStreamReader in = new InputStreamReader(System.in);
      BufferedReader br =new BufferedReader(in);
      int r,c,sum=1,s;
      System.out.println("Enter the no of rows you want");
      int n=Integer.parseInt(br.readLine());
      for(r=1;r<=n;r++)
      {
      sum+=r;
      s=sum-r;
      for(c=1;c<=r;c++)
      {

      System.out.print((char)(96+c)+""+s+" ");
      s++;
      }
      System.out.println();
      }
      }
      }

      Delete
  20. plz help me
    987654321
    87654321
    7654321
    654321
    54321
    4321
    321
    21
    1

    ReplyDelete
    Replies
    1. import java.io.*;
      public class pattern
      {
      public void main()throws IOException
      {
      int r,c,a;
      InputStreamReader in = new InputStreamReader(System.in);
      BufferedReader br =new BufferedReader(in);
      System.out.println("How many rows do you want?");
      a=Integer.parseInt(br.readLine());
      for(r=a;r>=1;r--)
      {
      for (c=r;c>=1;c--)
      System.out.print(c+" ");
      System.out.println();
      }
      }
      }

      Delete
  21. get output as
    0
    10
    101
    0101
    01010

    ReplyDelete
  22. how to do it


    555555555
    4444 4444
    333 333
    22 22
    1 1
    22 22
    333 333
    4444 4444
    555555555

    ReplyDelete
    Replies
    1. import java.io.*;
      public class pattern
      {
      public void main() throws IOException
      {
      InputStreamReader in=new InputStreamReader(System.in);
      BufferedReader br=new BufferedReader (in);
      int a,r,c;
      System.out.println("Enter the no. of rows you want");
      a=Integer.parseInt(br.readLine());
      System.out.println();
      for(r=a;r>=1;r--)
      System.out.print(a);
      for(r=a;r>=1;r--)
      System.out.print(a);
      System.out.println();
      for(r=a-1;r>=1;r--)
      {
      for(c=1;c<=r;c++)
      System.out.print(r);
      System.out.print(" ");
      for(c=1;c<=r;c++)
      System.out.print(r);
      System.out.println();
      }
      for(r=2;r<=a-1;r++)
      {
      for(c=1;c<=r;c++)
      System.out.print(r);
      System.out.print(" ");
      for(c=1;c<=r;c++)
      System.out.print(r);
      System.out.println();
      }
      for(r=a;r>=1;r--)
      System.out.print(a);
      for(r=a;r>=1;r--)
      System.out.print(a);
      }
      }

      Delete
  23. please help me with this code:
    00000
    00123
    01357
    025811

    ReplyDelete
  24. * * * * *
    * * * *
    * * *
    * *
    *
    * *
    * * *
    * * * *
    * * * * *

    ReplyDelete
  25. 1 3 5 7 9
    3 5 7 9 1
    5 7 9 1 3
    7 9 1 3 5
    9 1 3 5 7
    plz solve this for me

    ReplyDelete
    Replies
    1. /*
      1 3 5 7 9
      3 5 7 9 1
      5 7 9 1 3
      7 9 1 3 5
      9 1 3 5 7
      */
      public class pattern3
      {
      public static void main()
      {
      int i,j,k;
      for(i=1;i<=10;i+=2)
      {
      for(k=i;k<=10;k+=2)
      {
      System.out.print(k+" ");
      }
      for(j=1;j<=i-2;j+=2)
      {
      System.out.print(j+" ");
      }
      System.out.println();
      }
      }
      }

      Delete
    2. This doesn't work....
      Please review your code..

      Delete
    3. This comment has been removed by the author.

      Delete
    4. The right code
      import java.util.Scanner;
      public class s_13579_35791
      {
      static void main()
      {
      Scanner ob=new Scanner(System.in);
      int k=1;
      for (int i=1;i<=5;i++)
      {
      for (int j=1;j<=5;j++)
      {
      System.out.print(k);
      if (k==9)
      k=1;
      else
      k+=2;
      }
      k+=2;
      System.out.println();
      }
      }
      }
      Output:
      13579
      35791
      57913
      79135
      91357

      Delete
  26. pls tell me how to print the pattern
    12345
    22345
    33345
    44445
    55555

    ReplyDelete
  27. plz tell me how to print the pattern
    13579
    35791
    57913
    79135
    91357

    ReplyDelete
    Replies
    1. class pat1{
      public static void main(String args[])
      {
      String n="1 3 5 7 9";
      int l=n.length();

      for(int i=0;i<l;i=i+2)
      {
      String w=n.substring(i,l);
      String q=n.substring(0,i);
      System.out.print(w+" ");
      System.out.print(q+" ");
      System.out.println();
      }
      }
      }

      Delete
    2. /* 1 3 5 7 9
      3 5 7 9 1
      5 7 9 1 3
      7 9 1 3 5
      9 1 3 5 7*/
      public class pattern
      {
      public static void main()
      {
      int i,j,k;
      for(i=1;i<=10;i+=2)
      {
      for(k=i;k<=10;k+=2)
      {
      System.out.print(k+" ");
      }
      for(j=1;j<=i-2;j+=2)
      {
      System.out.print(j+" ");
      }
      System.out.println();
      }
      }
      }

      Delete
  28. plz tell he how to print the pattern
    1
    10
    101
    1010
    10101

    ReplyDelete
    Replies
    1. /* 1
      * 1 0
      * 1 0 1
      * 1 0 1 0
      * 1 0 1 0 1
      */
      public class pg_166_Q19_d_
      {
      public static void main(String args[])
      {
      int i,j,k;
      for(i=1;i<=5;i++){
      for(j=1;j<=i;j++){
      k=(j%2==0)?0:1;
      System.out.print(k+" ");
      }
      System.out.println();
      }
      }
      }

      Delete
  29. plz tell me for this one
    WAPto compute charges for sending parcels where the charges are as follows :
    for the first 1kg RS.25
    for additional weight of 500gms or fraction thereof Rs. 10
    Input the weight of a parcel from the user , display the amount to be paid by the customer

    ReplyDelete
    Replies
    1. you should use slab based program

      Delete
    2. import....
      class...
      {
      public....
      {
      BufferedReader......
      System.out.println("enter the weight of a parcel").
      double w=Double.parseDouble.....;
      int ch=0;
      int w=(int)(w*1000);
      w-=1000;
      ch+=25;
      while(w>0)
      {
      w-=500;
      ch+=10;
      }
      System.out.println(ch);
      }
      }
      this is the right program

      Delete
  30. plz.... help me to solve this........
    1
    121
    12321
    1234321
    123454321
    1234321
    12321
    121
    1

    ReplyDelete
  31. Can ayone plese hep me with this pattern. If array is to be used, then use single dimensional array please.
    RRRRRRRRR
    ROOOOOOR
    ROHHHHOR
    ROH I I I HOR
    ROH I T I HOR
    ROH I I I HOR
    ROHHHHOR
    ROOOOOOR
    RRRRRRRRR

    ReplyDelete
  32. I have some more programme which I am unable to do it I am class 9 student please tell me the site from where I can find all programme if u will tell me I will e-mail u all the programme please help me............and if u now any book which can help me in java please inform me

    ReplyDelete
  33. code for
    1
    3 1
    5 3 1
    7 5 3 1
    9 7 5 3 1

    ReplyDelete
    Replies
    1. class pattern
      {
      public static void main(String arg[])
      {
      for(int i=1;i<=9;i+=2)
      {
      for(int j=i;j>=1;j-=2)
      {
      System.out.print(" "+j);
      }
      System.out.println();
      }
      }
      }

      Delete
  34. here's my calc program ( dunno if it is the right place to post, but still here it is ) :
    http://rjt-rockx.yolasite.com/calc.php
    hope it helps !

    ReplyDelete
  35. Please help
    Pattern is
    1,11,111..........
    must continue till there are 10 1s

    ReplyDelete
    Replies
    1. I hope this is what you require

      class patternabc{
      void main (){
      for (int i=1;i<=5;i++){
      for (int j=1;j<=i;j++){
      System.out.print("1");}
      System.out.println();}
      }}

      Delete
    2. Hello anyone I challenge to all Bloggers if they have the potential then solve this problem other wise close this blog page
      can any one solve this problem Print the word BHUPENDRA in star pattern or any other word given by user it should be printed in horizontal way

      Delete
    3. What exactly do you mean to say by 'star pattern' ?

      Delete
  36. 123454321
    1234 4321
    123 321
    12 21
    1 1
    sir plz provide the code for dis pattern

    ReplyDelete
  37. * *
    *
    * *
    plz provide the code for dis pattern

    ReplyDelete
    Replies
    1. class prog
      {
      public static void main()
      {
      for(int x=1;x<=3;x++)
      {
      if(x%2==0)
      System.out.print("*");
      else
      System.out.print("**");
      System.out.println();
      }
      }
      }

      Delete
  38. 1 1
    12 21
    123 321
    1234321

    ReplyDelete
    Replies
    1. public class InternetPattern {
      public static void main(String[] args) {
      int[][]arr={{1,1},{12,21},{123,321},{1234321}};
      for(int i=0;i<arr.length;i++)
      {
      for(int j=0;j<arr[i].length;j++)
      {
      System.out.print(arr[i][j]+" ");

      }
      System.out.println();
      }
      }
      }

      Delete
  39. This comment has been removed by the author.

    ReplyDelete
  40. Replies
    1. class pattern
      {
      public static void main(String arg[])
      {
      for(int i=5;i>=1;i--)
      {
      for(int j=i;j<=5;j++)
      {
      System.out.print(" "+j);
      }
      System.out.println();
      }
      }
      }

      Delete
  41. how to print this pattern:-
    13579
    3579
    579
    79
    9

    ReplyDelete
  42. Hello can any one solve this problem Print the word BHUPENDRA in star pattern or any other word given by user

    ReplyDelete
  43. Hello can any one solve this problem Print ★ shape pattern inside this print asterisk symbol

    ReplyDelete
  44. help me plzzzz....
    J
    EE
    UUU
    LLLL
    BBBBB

    ReplyDelete
  45. CAN YOU PLZZZ refer me the best book for ICSE computer applications

    ReplyDelete
  46. Hello anyone I challenge to all Bloggers if they have the potential then solve this problem other wise close this blog page
    can any one solve this problem Print the word BHUPENDRA in star pattern or any other word given by user it should be printed in horizontal way

    ReplyDelete
  47. Hello everyone I challenge to all Bloggers if they have the potential then solve this problem other wise close this blog page
    can any one solve this problem Print the word BHUPENDRA in star pattern or any other word given by user it should be printed in horizontal way

    ReplyDelete
  48. Hello anyone I challenge to all Bloggers if they have the potential then solve this problem other wise close this blog page
    can any one solve this problem Print the word BHUPENDRA in star pattern or any other word given by user it should be printed in horizontal way

    ReplyDelete
  49. Hello anyone I challenge to all Bloggers if they have the potential then solve this problem other wise close this blog page
    can any one solve this problem Print the word BHUPENDRA in star pattern or any other word given by user it should be printed in horizontal way

    ReplyDelete
  50. plz help to print
    this pattern

    1 2 3
    1 2 3
    1 2 3

    ReplyDelete
  51. How to PRINT THIS:
    I I
    I I I I
    I I I I I

    ReplyDelete
  52. 1
    232
    34543
    4567654
    567898765

    need help plz!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    ReplyDelete
  53. 0
    101
    21012
    3210123
    432101234
    54321012345
    Pls help to solve this

    ReplyDelete
  54. Please help to print this pattern

    1
    2*3
    4*5*6
    4*5*6
    2*3
    1

    ReplyDelete
  55. Can any one tell me a trick to solve any given pattern.......plz as fast as possible really required for my exams......Thanks in advance 😊

    ReplyDelete
  56. plz do this :- 6 6 6 6 6 6
    5 5 5 5 5
    4 4 4 4
    3 3 3
    2 2
    1

    ReplyDelete
    Replies
    1. public class NumPtr {

      /**
      * @param args the command line arguments
      */
      public static void main(String[] args) {

      for(int i=5;i>=1;i--){
      for(int j=i;j>=1;j--){
      System.out.print(i+"");

      }
      System.out.println();
      }
      }
      }

      Delete
  57. *********
    *
    *
    *
    *
    *********
    plezz do this

    ReplyDelete
  58. Can you give me the answer
    1000A
    010B0
    00C00
    0D010
    E0001

    ReplyDelete
  59. Please do as soon as possible.....have an exam tomorrow

    ReplyDelete
  60. 13579
    35791
    57813
    79135
    91357

    ReplyDelete
    Replies
    1. /* 1
      * 1 0
      * 1 0 1
      * 1 0 1 0
      * 1 0 1 0 1
      */
      public class pg_166_Q19_d_
      {
      public static void main(String args[])
      {
      int i,j,k;
      for(i=1;i<=5;i++){
      for(j=1;j<=i;j++){
      k=(j%2==0)?0:1;
      System.out.print(k+" ");
      }
      System.out.println();
      }
      }
      }

      Delete
  61. Please answer this:-
    1 3 5 7 9
    3 5 7 9
    5 7 9
    7 9
    9

    ReplyDelete
  62. please answer the above program fast...because i have an exam this monday

    ReplyDelete
    Replies
    1. class pattern
      {

      public static void main(String[] args)
      {

      int i, j;

      for(i=1;i<=9;i=i+2)
      {
      for(j=i;j<=9;j=j+2)
      {
      System.out.print(j+" ") ;
      }

      System.out.println() ;

      }

      }

      }

      Delete
    2. Thank you very much....I have another program will you please answer it

      Delete
  63. WAP to do the following patterns:-

    a.) 1
    2 1
    3 2 1
    4 3 2 1
    5 4 3 2 1
    b.)
    1 2 3 4 5
    1 2 3 4
    1 2 3
    1 2
    1

    c.) 5 4 3 2 1
    5 4 3 2
    5 4 3
    5 4
    5

    d.)

    \






































































































































    WAp in JAVA TO PRINT:_

    1
    2 1
    3 2 1
    4 3 2 1
    5 4 3 2 1
































































































    ReplyDelete
  64. 13579
    35791
    57813
    79135
    91357

    ReplyDelete
    Replies
    1. Plz do this pattern.

      Delete
    2. /* 1
      * 1 0
      * 1 0 1
      * 1 0 1 0
      * 1 0 1 0 1
      */
      public class pg_166_Q19_d_
      {
      public static void main(String args[])
      {
      int i,j,k;
      for(i=1;i<=5;i++){
      for(j=1;j<=i;j++){
      k=(j%2==0)?0:1;
      System.out.print(k+" ");
      }
      System.out.println();
      }
      }
      }

      Delete
  65. How to bring this output
    123456787654321

    ReplyDelete
  66. Solve this:
    tiger
    ige
    g
    ige
    tiger

    The word could be anything inputted by the user

    Solve this plzzzz
    And earn a cookie! :D

    ReplyDelete
  67. Solve this:
    tiger
    ige
    g
    ige
    tiger

    The word could be anything inputted by the user

    Solve this plzzzz
    And earn a cookie! :D

    ReplyDelete
  68. generate the following series
    a)
    2,5,10,17,26.............n terms

    b)
    11,22,33,44.................n terms

    c)
    0,4,18,48,100..........n terms

    ReplyDelete
    Replies
    1. answer to b)

      class prog
      {
      public static void main(int n)
      {int x=11;
      for(int t=1;t<=n;t++)
      {
      System.out.println(x);
      x=x+11;
      }
      }
      }

      Delete
  69. *****
    * *
    * *
    *
    please solve it....plz plz

    ReplyDelete
  70. This comment has been removed by the author.

    ReplyDelete
  71. 1 2 3 4
    5 6 7
    8 9
    10

    Please solve this

    ReplyDelete
  72. 1 2 3 4
    5 6 7
    8 9
    10

    Please solve this

    ReplyDelete
  73. This comment has been removed by the author.

    ReplyDelete
  74. This comment has been removed by the author.

    ReplyDelete
  75. 12345
    1234
    123
    12
    1
    Please give code...

    ReplyDelete
    Replies
    1. class Pattern1
      {
      public static void main()
      {
      for(int r=5;r>=1;r--)
      {
      for(int c=1;c<=r;c++)
      System.out.print(c);

      System.out.println();
      }
      }
      }

      Delete
  76. can u plz help to print the following series
    1
    13
    135
    1357

    ReplyDelete

ShareThis