0 | |
By: [email protected] On: Fri May 05 09:51:31 IST 2017 0 0 0 | 0 |
Are You Satisfied :0Yes0No |
0 | |
By: [email protected] On: Mon May 08 11:31:13 IST 2017 0 0 0 | 0 |
Are You Satisfied :0Yes0No |
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package javaapplication11; import java.util.Scanner; /** * * @author SATVIK */ public class JavaApplication11 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here try{ Scanner sc=new Scanner(System.in); int n; System.out.print("Enter n:"); n=sc.nextInt(); int [][]aray=new int[n][n]; int temp= n -(n-1); for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { if(j==(n/2) && i>0) { aray[i][j]=temp; temp++; } else if(j==(n/2) && i==0) { aray[i][j]=n; } else { aray[i][j]=n; } } } System.out.print("Array \n"); for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { System.out.print(aray[i][j]); } System.out.println(""); } int i=n-1; if(i==(n-1)) { for (int j=0;j<n;j++) {System.out.print(n);} } } catch(Exception e) { System.out.print(e); } } } | 0 |
By: [email protected] On: Mon May 08 12:26:14 IST 2017 0 0 0 | 0 |
Are You Satisfied :0Yes0No |