JeffGrigg

RaviShankarOjhaExample

Apr 28th, 2017
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.59 KB | None | 0 0
  1. /**
  2.  * Ravi Shankar Ojha
  3.  * https://www.facebook.com/groups/javaharikrishna/permalink/1164877420304483/?comment_id=1165276810264544
  4.  */
  5. public class RaviShankarOjhaExample {
  6.     public static void main(String[] args){
  7.         int cnt=0;
  8.         for(int y=7; y>=0;y--)
  9.         {
  10.             for(int x=(5-cnt); x>0; x--)
  11.             {
  12.                 if(y%2==1 || y==0)
  13.                 {
  14.                     System.out.print(y*x+" ");
  15.                 }
  16.             }
  17.             if(y%2==1 || y==0){
  18.                 cnt++;
  19.             }
  20.             System.out.println();
  21.         }
  22.     }
  23. }
Add Comment
Please, Sign In to add comment