Posts

JAVA PROGRAM TO REVERSE THE ARRAY ELEMENT.

Image
Java Program to reverse the element present in the Array. Example:-             Index no:-        0     1     2     3     4     5    6 If the array is :-          [76][49][73][50][93][04][27]              Index no:-        0     1     2    3     4    5     6 Then it should print:- [27][04][93][50][73][49][79] import java.util.Scanner; public class ReverseArray { public static void main(String[] args) { int a[]; int size; Scanner sc=new Scanner(System.in); System.out.print("Enter the size of the array :  "); size=sc.nextInt(); a=new int[size]; System.out.println("\nEnter "+size+" elements in the Array"); for(int i=0;i<size;i++) a[i]=sc.nextInt(); System.out.println("Your Reverse Array is "); int rev[]=new int[size]; for(int i=0;i<size;i++) rev[size-i-1]=a[i]; for(int i=0;i<size;i++) System.out.print(rev[i]+"\t"); } } The output is :-

Java program to draw pattern of Indian Map

Image
Java Program to draw Indian Map Pattern. Source Code for the Indian Map Pattern public class Indiamap {  public static void main(String[] args) { int i,j;  for (i=0;i<=40;i++ )  {  for(j=0;j<=34;j++) { if( (i==4&&(j>=8&&j<=11)) ||  (i==5&&(j>=7&&j<=12)) || (i==6&&(j>=9&&j<=15)) ||  (i==7&&(j>=8&&j<=15)) || (i==8&&(j>=9&&j<=14)) ||  (i==9&&(j>=10&&j<=14)) ||  (i==10&&(j>=10&&j<=13)) || (i==11&&(j>=10&&j<=14)) ||  (i==12&&(j>=9&&j<=15)) || (i==13&&((j>=8&&j<=14)||(j>=32&&j<=33))) ||  (i==14&&((j>=7&&j<=15)||(j>=31&&j<=34))) ||  (i==15&&((j>=6&&j<=17)|| (j==25)||(j>=29&&j<=34)))||  (i==16&&((j>=4&&j<=20)|| (j==25)||(j>=28

How to install NASM and compile Assembly program in kali linux.

Image
Here i am going to show you how you can install NASM compiler to compile your assembly program in kali linux or any other linux. Step 1: Open terminal in your linux. Step 2: To download and install linux write the command on your terminal                                           " apt-get install nasm" Step 3: Open your text editor and write Hello World program and save it with  .asm file extension.   section .text global _start   _start: mov edx,len mov ecx,msg mov ebx,1 mov eax,4 int 0x80 mov eax,1 int 0x80   section .data   msg db 'hello World!' , 0xa   len equ $ -msg         Step 4: To compile the program write " nasm -f elf64 hello.asm " .             ->Here " hello.asm " is the file name so don't get confused.             ->If your system is 32 bit then you should use " nasm -f elf32 hello.asm "             ->If your system is 64 bit then you should use "nasm -f elf64

Print message without main method in java.

Image
Here i am gonna show you how you can print message without main method and without executing your java program. You just need to do is to write the program in your text-editor and compile it using javac in command-prompt.  class con  {  String s="\n\n\n\n\n\n\n\n\nI am in coding page\n\n\n\n\n\n\n";  } Save it with any file name but other than con For example you can save it with demo.java Compile it  javac demo.java After compiling your code you will get a output like this.